39 lines
1.2 KiB
TypeScript
Raw Normal View History

import expect from 'app/test/unexpected';
2019-12-07 13:28:52 +02:00
import auth from './reducer';
import { setLogin, setAccountSwitcher } from './actions';
2016-11-13 16:47:56 +02:00
describe('components/auth/reducer', () => {
2020-05-24 02:08:24 +03:00
describe('auth:setCredentials', () => {
it('should set login', () => {
const expectedLogin = 'foo';
2020-05-24 02:08:24 +03:00
expect(auth(undefined, setLogin(expectedLogin)).credentials, 'to satisfy', {
login: expectedLogin,
});
});
});
2016-11-13 16:47:56 +02:00
2020-05-24 02:08:24 +03:00
describe('auth:setAccountSwitcher', () => {
it('should be enabled by default', () =>
expect(auth(undefined, {} as any), 'to satisfy', {
isSwitcherEnabled: true,
}));
2016-11-13 16:47:56 +02:00
2020-05-24 02:08:24 +03:00
it('should enable switcher', () => {
const expectedValue = true;
2016-11-13 16:47:56 +02:00
2020-05-24 02:08:24 +03:00
expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
isSwitcherEnabled: expectedValue,
});
});
2016-11-13 16:47:56 +02:00
2020-05-24 02:08:24 +03:00
it('should disable switcher', () => {
const expectedValue = false;
2016-11-13 16:47:56 +02:00
2020-05-24 02:08:24 +03:00
expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
isSwitcherEnabled: expectedValue,
});
});
2016-11-13 16:47:56 +02:00
});
});