Download react-boilerplate/app/containers/HomePage/tests/reducer.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 715 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/containers/HomePage/tests/reducer.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-boilerplate/app/containers/HomePage/tests/reducer.test.js
-
curl -L -o reducer.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/containers/HomePage/tests/reducer.test.js
715 Bytes
| import produce from 'immer'; | |
| import homeReducer from '../reducer'; | |
| import { changeUsername } from '../actions'; | |
| /* eslint-disable default-case, no-param-reassign */ | |
| describe('homeReducer', () => { | |
| let state; | |
| beforeEach(() => { | |
| state = { | |
| username: '', | |
| }; | |
| }); | |
| it('should return the initial state', () => { | |
| const expectedResult = state; | |
| expect(homeReducer(undefined, {})).toEqual(expectedResult); | |
| }); | |
| it('should handle the changeUsername action correctly', () => { | |
| const fixture = 'mxstbr'; | |
| const expectedResult = produce(state, draft => { | |
| draft.username = fixture; | |
| }); | |
| expect(homeReducer(state, changeUsername(fixture))).toEqual(expectedResult); | |
| }); | |
| }); | |