|
@ -2,6 +2,8 @@ import configStore from '../src/redux/CreateStore'; |
|
|
import {systemReducer} from '../src/redux/reducers/SystemReducer'; |
|
|
import {systemReducer} from '../src/redux/reducers/SystemReducer'; |
|
|
import rootReducer from '../src/redux/reducers/RootReducer'; |
|
|
import rootReducer from '../src/redux/reducers/RootReducer'; |
|
|
import { APP_INIT } from '../src/redux/types/SystemTypes'; |
|
|
import { APP_INIT } from '../src/redux/types/SystemTypes'; |
|
|
|
|
|
import { userReducer } from '../src/redux/reducers/UserReducer'; |
|
|
|
|
|
import { ADDITION_FINISHED, ADDITION_START, SQUARE_FINISHED, SQUARE_START } from '../src/redux/types/UserTypes'; |
|
|
jest.useRealTimers(); |
|
|
jest.useRealTimers(); |
|
|
|
|
|
|
|
|
test('configures redux store', () => { |
|
|
test('configures redux store', () => { |
|
@ -16,4 +18,29 @@ test('rootReducer constructs', () => { |
|
|
test('systemReducer response to app-init', () => { |
|
|
test('systemReducer response to app-init', () => { |
|
|
let nextState = systemReducer.system({}, {type: APP_INIT, system: {value: 0}}); |
|
|
let nextState = systemReducer.system({}, {type: APP_INIT, system: {value: 0}}); |
|
|
expect(nextState.value).toEqual(0); |
|
|
expect(nextState.value).toEqual(0); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('userReducer response to app-init', () => { |
|
|
|
|
|
let nextState = userReducer.user({}, {type: APP_INIT, user: {username: 'unittest'}}); |
|
|
|
|
|
expect(nextState.username).toEqual('unittest'); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('userReducer response to square-start', () => { |
|
|
|
|
|
let nextState = userReducer.user({}, {type: SQUARE_START, user: {username: 'unittest'}}); |
|
|
|
|
|
expect(nextState.username).toEqual('unittest'); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('userReducer response to addition-start', () => { |
|
|
|
|
|
let nextState = userReducer.user({}, {type: ADDITION_START, user: {username: 'unittest'}}); |
|
|
|
|
|
expect(nextState.username).toEqual('unittest'); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('userReducer response to square-finished', () => { |
|
|
|
|
|
let nextState = userReducer.user({}, {type: SQUARE_FINISHED, user: {username: 'unittest'}}); |
|
|
|
|
|
expect(nextState.username).toEqual('unittest'); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
test('userReducer response to addition-finished', () => { |
|
|
|
|
|
let nextState = userReducer.user({}, {type: ADDITION_FINISHED, user: {username: 'unittest'}}); |
|
|
|
|
|
expect(nextState.username).toEqual('unittest'); |
|
|
}) |
|
|
}) |