Download react-boilerplate/internals/generators/container/reducer.test.js.hbs from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 869 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/internals/generators/container/reducer.test.js.hbs
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-boilerplate/internals/generators/container/reducer.test.js.hbs
-
curl -L -o reducer.test.js.hbs https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/internals/generators/container/reducer.test.js.hbs
869 Bytes
| // import produce from 'immer'; | |
| import {{ camelCase name }}Reducer from '../reducer'; | |
| // import { someAction } from '../actions'; | |
| /* eslint-disable default-case, no-param-reassign */ | |
| describe('{{ camelCase name }}Reducer', () => { | |
| let state; | |
| beforeEach(() => { | |
| state = { | |
| // default state params here | |
| }; | |
| }); | |
| it('returns the initial state', () => { | |
| const expectedResult = state; | |
| expect({{ camelCase name }}Reducer(undefined, {})).toEqual(expectedResult); | |
| }); | |
| /** | |
| * Example state change comparison | |
| * | |
| * it('should handle the someAction action correctly', () => { | |
| * const expectedResult = produce(state, draft => { | |
| * draft.loading = true; | |
| * draft.error = false; | |
| * draft.userData.nested = false; | |
| * }); | |
| * | |
| * expect(appReducer(state, someAction())).toEqual(expectedResult); | |
| * }); | |
| */ | |
| }); | |