Browse Source

user reducer tests

pull/11/head
Tim Glasgow 2 years ago
parent
commit
7a2b1dd893
  1. 27
      squarenotsquare/__tests__/Redux-test.js

27
squarenotsquare/__tests__/Redux-test.js

@ -2,6 +2,8 @@ import configStore from '../src/redux/CreateStore';
import {systemReducer} from '../src/redux/reducers/SystemReducer';
import rootReducer from '../src/redux/reducers/RootReducer';
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();
test('configures redux store', () => {
@ -17,3 +19,28 @@ test('systemReducer response to app-init', () => {
let nextState = systemReducer.system({}, {type: APP_INIT, system: {value: 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');
})
Loading…
Cancel
Save