Last active
March 27, 2021 21:39
-
-
Save andirkh/264973c7ab7762f2673a11f43a02a40f to your computer and use it in GitHub Desktop.
Template for testing reducer
This file contains 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 ReducerName, { | |
initialState, | |
} from '#src/containers/ContainerName/reducer'; | |
import { | |
... | |
} from '#src/containers/ContainerName/constants'; | |
describe('ReducerName reducer', () => { | |
const initialStateJS = initialState.toJS(); | |
const testTable = [ | |
{ | |
title: 'it should return initial state', | |
action: { type: undefined }, | |
expected: initialStateJS, | |
}, | |
]; | |
testTable.forEach(({ title, action, expected }) => { | |
it(`${title}`, () => { | |
expect(ReducerName(initialState, action).toJS()).toEqual( | |
expected | |
); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment