This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { getByTestId } = render( | |
| <Provider store={store}> | |
| <Header /> | |
| </Provider> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('should modify state', () => { | |
| store.dispatch(onModify('Modified by click')); | |
| expect(store.getState()).toEqual('Modified by click'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createStore } from 'redux'; | |
| function info(state, action) { | |
| switch (action.type) { | |
| case 'MODIFY': | |
| return action.payload; | |
| default: | |
| return state; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('toUpperCase', () => { | |
| it('should convert string to upper case', () => { | |
| // Arrange | |
| const toUpperCase = info => info.toUpperCase(); | |
| // Act | |
| const result = toUpperCase('Click to modify'); | |
| // Assert | |
| expect(result).toEqual('CLICK TO MODIFY'); |