Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Baby } from './entities/baby';
  2. var deepFreeze = require('deep-freeze');
  3. import { rootReducer, INITIAL_STATE } from './store';
  4. import * as types from './actions';
  5.  
  6. describe('users reducer', () => {
  7.  it('should return the initial state', () => {
  8.    expect(rootReducer(INITIAL_STATE, {})).toEqual({
  9.     babies: [],
  10.     sitters: [],
  11.     users: [],
  12.     loggedInUser: null,
  13.     subject: null
  14.    });
  15. });
  16.  
  17. it('Should add a new baby object to array of babies', () => {
  18.     let state = {babies: []};
  19.     deepFreeze(state);
  20.  
  21.     let newBaby = { firstname: 'Roland', postalCode: '2400', picture: 'no picture yet', age: 8, gender: 'MALE' };
  22.  
  23.     expect( rootReducer(state, {
  24.       type: types.ADD_BABY,
  25.       payload: newBaby
  26.      })).toEqual({babies: [{ firstname: 'Roland', postalCode: '2400', picture: 'no picture yet', age: 8, gender: 'MALE' }]});
  27.   });
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement