shlink-web-client/test/common/reducer/sidebar.test.ts

32 lines
856 B
TypeScript
Raw Normal View History

2022-03-11 18:12:54 +03:00
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([
2022-03-26 14:17:42 +03:00
[SIDEBAR_PRESENT, { sidebarPresent: true }],
[SIDEBAR_NOT_PRESENT, { sidebarPresent: false }],
2022-03-11 18:12:54 +03:00
])('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 });
});
});
});