mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-28 04:36:45 +00:00
Migrated sidebar reducer to RTK
This commit is contained in:
@@ -1,31 +1,24 @@
|
||||
import { Mock } from 'ts-mockery';
|
||||
import reducer, {
|
||||
Sidebar,
|
||||
SIDEBAR_NOT_PRESENT,
|
||||
SIDEBAR_PRESENT,
|
||||
sidebarNotPresent,
|
||||
sidebarPresent,
|
||||
} from '../../../src/common/reducers/sidebar';
|
||||
import { sidebarReducer, sidebarNotPresent, sidebarPresent } from '../../../src/common/reducers/sidebar';
|
||||
|
||||
describe('sidebarReducer', () => {
|
||||
describe('reducer', () => {
|
||||
it.each([
|
||||
[SIDEBAR_PRESENT, { sidebarPresent: true }],
|
||||
[SIDEBAR_NOT_PRESENT, { sidebarPresent: false }],
|
||||
[sidebarPresent.toString(), { sidebarPresent: true }],
|
||||
[sidebarNotPresent.toString(), { sidebarPresent: false }],
|
||||
])('returns expected on %s', (type, expected) => {
|
||||
expect(reducer(Mock.all<Sidebar>(), { type })).toEqual(expected);
|
||||
expect(sidebarReducer(undefined, { type })).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('sidebarPresent', () => {
|
||||
it('returns expected action', () => {
|
||||
expect(sidebarPresent()).toEqual({ type: SIDEBAR_PRESENT });
|
||||
expect(sidebarPresent()).toEqual({ type: sidebarPresent.toString() });
|
||||
});
|
||||
});
|
||||
|
||||
describe('sidebarNotPresent', () => {
|
||||
it('returns expected action', () => {
|
||||
expect(sidebarNotPresent()).toEqual({ type: SIDEBAR_NOT_PRESENT });
|
||||
expect(sidebarNotPresent()).toEqual({ type: sidebarNotPresent.toString() });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user