Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. // Exemplo retirado da documentacao do redux
  2.  
  3. import reducer from '../../structuring-reducers/todos'
  4. import * as types from '../../constants/ActionTypes'
  5.  
  6. describe('todos reducer', () => {
  7. it('should return the initial state', () => {
  8. expect(reducer(undefined, {})).toEqual([
  9. {
  10. text: 'Use Redux',
  11. completed: false,
  12. id: 0
  13. }
  14. ])
  15. })
  16.  
  17. it('should handle ADD_TODO', () => {
  18. expect(
  19. reducer([], {
  20. type: types.ADD_TODO,
  21. text: 'Run the tests'
  22. })
  23. ).toEqual([
  24. {
  25. text: 'Run the tests',
  26. completed: false,
  27. id: 0
  28. }
  29. ])
  30.  
  31. expect(
  32. reducer(
  33. [
  34. {
  35. text: 'Use Redux',
  36. completed: false,
  37. id: 0
  38. }
  39. ],
  40. {
  41. type: types.ADD_TODO,
  42. text: 'Run the tests'
  43. }
  44. )
  45. ).toEqual([
  46. {
  47. text: 'Run the tests',
  48. completed: false,
  49. id: 1
  50. },
  51. {
  52. text: 'Use Redux',
  53. completed: false,
  54. id: 0
  55. }
  56. ])
  57. })
  58. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement