Created sidebar reducer test

This commit is contained in:
Alejandro Celaya
2022-03-11 16:12:54 +01:00
parent c949359d6f
commit f15b803851
4 changed files with 38 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
import { Mock } from 'ts-mockery';
import reducer, {
Sidebar,
SIDEBAR_NOT_PRESENT,
SIDEBAR_PRESENT,
sidebarNotPresent,
sidebarPresent,
} from '../../../src/common/reducers/sidebar';
describe('sidebarReducer', () => {
describe('reducer', () => {
it.each([
[ SIDEBAR_PRESENT, { sidebarPresent: true }],
[ SIDEBAR_NOT_PRESENT, { sidebarPresent: false }],
])('returns expected on %s', (type, expected) => {
expect(reducer(Mock.all<Sidebar>(), { type })).toEqual(expected);
});
});
describe('sidebarPresent', () => {
it('returns expected action', () => {
expect(sidebarPresent()).toEqual({ type: SIDEBAR_PRESENT });
});
});
describe('sidebarNotPresent', () => {
it('returns expected action', () => {
expect(sidebarNotPresent()).toEqual({ type: SIDEBAR_NOT_PRESENT });
});
});
});