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

32 lines
858 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([
[ 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 });
});
});
});