2019-12-08 00:32:00 +05:30
|
|
|
import expect from 'app/test/unexpected';
|
2019-12-07 16:58:52 +05:30
|
|
|
import auth from './reducer';
|
2016-11-13 20:17:56 +05:30
|
|
|
import {
|
2019-11-27 14:33:32 +05:30
|
|
|
setLogin,
|
|
|
|
SET_CREDENTIALS,
|
|
|
|
setAccountSwitcher,
|
|
|
|
SET_SWITCHER,
|
2019-12-07 16:58:52 +05:30
|
|
|
} from './actions';
|
2016-11-13 02:01:44 +05:30
|
|
|
|
2016-11-13 20:17:56 +05:30
|
|
|
describe('components/auth/reducer', () => {
|
2019-11-27 14:33:32 +05:30
|
|
|
describe(SET_CREDENTIALS, () => {
|
|
|
|
it('should set login', () => {
|
|
|
|
const expectedLogin = 'foo';
|
|
|
|
|
|
|
|
expect(
|
|
|
|
auth(undefined, setLogin(expectedLogin)).credentials,
|
|
|
|
'to satisfy',
|
|
|
|
{
|
|
|
|
login: expectedLogin,
|
|
|
|
},
|
|
|
|
);
|
2016-11-13 02:01:44 +05:30
|
|
|
});
|
2019-11-27 14:33:32 +05:30
|
|
|
});
|
2016-11-13 20:17:56 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
describe(SET_SWITCHER, () => {
|
|
|
|
it('should be enabled by default', () =>
|
2019-12-07 16:58:52 +05:30
|
|
|
expect(auth(undefined, {} as any), 'to satisfy', {
|
2019-11-27 14:33:32 +05:30
|
|
|
isSwitcherEnabled: true,
|
|
|
|
}));
|
2016-11-13 20:17:56 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should enable switcher', () => {
|
|
|
|
const expectedValue = true;
|
2016-11-13 20:17:56 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
|
|
|
|
isSwitcherEnabled: expectedValue,
|
|
|
|
});
|
|
|
|
});
|
2016-11-13 20:17:56 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should disable switcher', () => {
|
|
|
|
const expectedValue = false;
|
2016-11-13 20:17:56 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
|
|
|
|
isSwitcherEnabled: expectedValue,
|
|
|
|
});
|
2016-11-13 20:17:56 +05:30
|
|
|
});
|
2019-11-27 14:33:32 +05:30
|
|
|
});
|
2016-11-13 02:01:44 +05:30
|
|
|
});
|