Move tests in same folder as modules

This is to make imports cleaner
This commit is contained in:
Jerko Steiner 2019-07-07 19:16:27 +08:00
parent bca30f37ad
commit 15e870a0d5
18 changed files with 47 additions and 47 deletions

View File

@ -104,7 +104,7 @@
"^.+\\.[t|j]sx?$": "<rootDir>/node_modules/babel-jest" "^.+\\.[t|j]sx?$": "<rootDir>/node_modules/babel-jest"
}, },
"setupFiles": [ "setupFiles": [
"./jest.setup.js" "<rootDir>/jest.setup.js"
], ],
"modulePathIgnorePatterns": [ "modulePathIgnorePatterns": [
"<rootDir>/node_modules/" "<rootDir>/node_modules/"

View File

@ -1,14 +1,14 @@
jest.mock('../../socket.js') jest.mock('../socket.js')
jest.mock('../../window.js') jest.mock('../window.js')
jest.mock('../../store.js') jest.mock('../store.js')
jest.mock('../SocketActions.js') jest.mock('./SocketActions.js')
import * as CallActions from '../CallActions.js' import * as CallActions from './CallActions.js'
import * as SocketActions from '../SocketActions.js' import * as SocketActions from './SocketActions.js'
import * as constants from '../../constants.js' import * as constants from '../constants.js'
import socket from '../../socket.js' import socket from '../socket.js'
import store from '../../store.js' import store from '../store.js'
import { callId, getUserMedia } from '../../window.js' import { callId, getUserMedia } from '../window.js'
jest.useFakeTimers() jest.useFakeTimers()

View File

@ -1,11 +1,11 @@
jest.mock('../../window.js') jest.mock('../window.js')
jest.mock('simple-peer') jest.mock('simple-peer')
import * as PeerActions from '../PeerActions.js' import * as PeerActions from './PeerActions.js'
import Peer from 'simple-peer' import Peer from 'simple-peer'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import { createStore } from '../../store.js' import { createStore } from '../store.js'
import { play } from '../../window.js' import { play } from '../window.js'
describe('PeerActions', () => { describe('PeerActions', () => {
function createSocket () { function createSocket () {

View File

@ -1,11 +1,11 @@
jest.mock('simple-peer') jest.mock('simple-peer')
jest.mock('../../window.js') jest.mock('../window.js')
import * as SocketActions from '../SocketActions.js' import * as SocketActions from './SocketActions.js'
import * as constants from '../../constants.js' import * as constants from '../constants.js'
import Peer from 'simple-peer' import Peer from 'simple-peer'
import { EventEmitter } from 'events' import { EventEmitter } from 'events'
import { createStore } from '../../store.js' import { createStore } from '../store.js'
describe('SocketActions', () => { describe('SocketActions', () => {
const roomName = 'bla' const roomName = 'bla'

View File

@ -1,4 +1,4 @@
import Input from '../Input.js' import Input from './Input.js'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import TestUtils from 'react-dom/test-utils' import TestUtils from 'react-dom/test-utils'

View File

@ -1,9 +1,9 @@
jest.mock('../../window.js') jest.mock('../window.js')
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import TestUtils from 'react-dom/test-utils' import TestUtils from 'react-dom/test-utils'
import Toolbar from '../Toolbar.js' import Toolbar from './Toolbar.js'
import { MediaStream } from '../../window.js' import { MediaStream } from '../window.js'
describe('components/Toolbar', () => { describe('components/Toolbar', () => {

View File

@ -1,9 +1,9 @@
jest.mock('../../window.js') jest.mock('../window.js')
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import TestUtils from 'react-dom/test-utils' import TestUtils from 'react-dom/test-utils'
import Video from '../Video.js' import Video from './Video.js'
import { MediaStream } from '../../window.js' import { MediaStream } from '../window.js'
describe('components/Video', () => { describe('components/Video', () => {

View File

@ -3,7 +3,7 @@ jest.mock('../socket.js')
jest.mock('../window.js') jest.mock('../window.js')
import * as constants from '../constants.js' import * as constants from '../constants.js'
import App from '../containers/App.js' import App from './App.js'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import TestUtils from 'react-dom/test-utils' import TestUtils from 'react-dom/test-utils'

View File

@ -1,5 +1,5 @@
import logger from 'redux-logger' import logger from 'redux-logger'
import { create } from '../middlewares.js' import { create } from './middlewares.js'
describe('store', () => { describe('store', () => {

View File

@ -1,5 +1,5 @@
import * as StreamActions from '../../actions/StreamActions.js' import * as StreamActions from '../actions/StreamActions.js'
import active from '../active.js' import active from './active.js'
describe('reducers/active', () => { describe('reducers/active', () => {

View File

@ -1,8 +1,8 @@
import * as NotifyActions from '../../actions/NotifyActions.js' import * as NotifyActions from '../actions/NotifyActions.js'
import _ from 'underscore' import _ from 'underscore'
import { applyMiddleware, createStore } from 'redux' import { applyMiddleware, createStore } from 'redux'
import { create } from '../../middlewares.js' import { create } from '../middlewares.js'
import reducers from '../index.js' import reducers from './index.js'
jest.useFakeTimers() jest.useFakeTimers()

View File

@ -1,5 +1,5 @@
import * as ChatActions from '../../actions/ChatActions.js' import * as ChatActions from '../actions/ChatActions.js'
import messages from '../messages.js' import messages from './messages.js'
describe('reducers/messages', () => { describe('reducers/messages', () => {

View File

@ -1,10 +1,10 @@
jest.mock('../../window.js') jest.mock('../window.js')
import * as StreamActions from '../../actions/StreamActions.js' import * as StreamActions from '../actions/StreamActions.js'
import reducers from '../index.js' import reducers from './index.js'
import { createObjectURL, MediaStream } from '../../window.js' import { createObjectURL, MediaStream } from '../window.js'
import { applyMiddleware, createStore } from 'redux' import { applyMiddleware, createStore } from 'redux'
import { create } from '../../middlewares.js' import { create } from '../middlewares.js'
describe('reducers/alerts', () => { describe('reducers/alerts', () => {

View File

@ -7,7 +7,7 @@ import {
navigator, navigator,
play, play,
valueOf valueOf
} from '../window.js' } from './window.js'
describe('window', () => { describe('window', () => {

View File

@ -2,11 +2,11 @@ jest.mock('socket.io', () => {
const { EventEmitter } = require('events') const { EventEmitter } = require('events')
return jest.fn().mockReturnValue(new EventEmitter()) return jest.fn().mockReturnValue(new EventEmitter())
}) })
jest.mock('../socket.js') jest.mock('./socket.js')
const app = require('../app.js') const app = require('./app.js')
const config = require('config') const config = require('config')
const handleSocket = require('../socket.js') const handleSocket = require('./socket.js')
const io = require('socket.io')() const io = require('socket.io')()
const request = require('supertest') const request = require('supertest')

View File

@ -1,7 +1,7 @@
const express = require('express') const express = require('express')
const http = require('http') const http = require('http')
const https = require('https') const https = require('https')
const { createServer } = require('../server.js') const { createServer } = require('./server.js')
describe('server', () => { describe('server', () => {

View File

@ -1,7 +1,7 @@
'use strict' 'use strict'
const EventEmitter = require('events').EventEmitter const EventEmitter = require('events').EventEmitter
const handleSocket = require('../socket.js') const handleSocket = require('./socket.js')
describe('server/socket', () => { describe('server/socket', () => {
let socket, io, rooms let socket, io, rooms

View File

@ -1,4 +1,4 @@
const turn = require('../turn.js') const turn = require('./turn.js')
describe('server/turn', () => { describe('server/turn', () => {
describe('getCredentials', () => { describe('getCredentials', () => {