First refactor of redux tests to avoid covering RTK implementation details

This commit is contained in:
Alejandro Celaya
2023-03-18 12:09:38 +01:00
parent a6d000714b
commit 9cefdb7977
4 changed files with 22 additions and 86 deletions

View File

@@ -3,22 +3,10 @@ import { sidebarNotPresent, sidebarPresent, sidebarReducer } from '../../../src/
describe('sidebarReducer', () => {
describe('reducer', () => {
it.each([
[sidebarPresent.toString(), { sidebarPresent: true }],
[sidebarNotPresent.toString(), { sidebarPresent: false }],
])('returns expected on %s', (type, expected) => {
expect(sidebarReducer(undefined, { type })).toEqual(expected);
});
});
describe('sidebarPresent', () => {
it('returns expected action', () => {
expect(sidebarPresent()).toEqual({ type: sidebarPresent.toString() });
});
});
describe('sidebarNotPresent', () => {
it('returns expected action', () => {
expect(sidebarNotPresent()).toEqual({ type: sidebarNotPresent.toString() });
[sidebarPresent, { sidebarPresent: true }],
[sidebarNotPresent, { sidebarPresent: false }],
])('returns expected on %s', (actionCreator, expected) => {
expect(sidebarReducer(undefined, actionCreator())).toEqual(expected);
});
});
});