Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  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 = INITIAL_STATE;
  19. deepFreeze(state);
  20.  
  21. let newBaby = { firstname: 'Roland', postalCode: '2400', picture: 'no picture yet', age: 8, gender: 'MALE' };
  22.  
  23. let expectedState = {
  24. babies: [ newBaby ],
  25. sitters: [],
  26. users: [],
  27. loggedInUser: null,
  28. subject: null
  29. }
  30.  
  31. expect( rootReducer(state, {
  32. type: types.ADD_BABY,
  33. payload: newBaby
  34. })).toEqual(expectedState);
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement