Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Exemplo retirado da documentacao do redux
- import reducer from '../../structuring-reducers/todos'
- import * as types from '../../constants/ActionTypes'
- describe('todos reducer', () => {
- it('should return the initial state', () => {
- expect(reducer(undefined, {})).toEqual([
- {
- text: 'Use Redux',
- completed: false,
- id: 0
- }
- ])
- })
- it('should handle ADD_TODO', () => {
- expect(
- reducer([], {
- type: types.ADD_TODO,
- text: 'Run the tests'
- })
- ).toEqual([
- {
- text: 'Run the tests',
- completed: false,
- id: 0
- }
- ])
- expect(
- reducer(
- [
- {
- text: 'Use Redux',
- completed: false,
- id: 0
- }
- ],
- {
- type: types.ADD_TODO,
- text: 'Run the tests'
- }
- )
- ).toEqual([
- {
- text: 'Run the tests',
- completed: false,
- id: 1
- },
- {
- text: 'Use Redux',
- completed: false,
- id: 0
- }
- ])
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement