shlink-web-client/test/common/reducer/sidebar.test.ts
2022-03-26 12:17:42 +01:00

31 lines
856 B
TypeScript

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 });
});
});
});