2016-11-13 02:01:44 +05:30
|
|
|
import expect from 'unexpected';
|
|
|
|
|
|
|
|
import auth from 'components/auth/reducer';
|
2016-11-13 20:17:56 +05:30
|
|
|
import {
|
|
|
|
setLogin, SET_LOGIN,
|
|
|
|
setAccountSwitcher, SET_SWITCHER
|
|
|
|
} from 'components/auth/actions';
|
2016-11-13 02:01:44 +05:30
|
|
|
|
2016-11-13 20:17:56 +05:30
|
|
|
describe('components/auth/reducer', () => {
|
2016-11-13 02:01:44 +05:30
|
|
|
describe(SET_LOGIN, () => {
|
|
|
|
it('should set login', () => {
|
|
|
|
const expectedLogin = 'foo';
|
|
|
|
|
|
|
|
expect(auth(undefined, setLogin(expectedLogin)), 'to satisfy', {
|
|
|
|
login: expectedLogin
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-11-13 20:17:56 +05:30
|
|
|
|
|
|
|
describe(SET_SWITCHER, () => {
|
|
|
|
it('should be enabled by default', () =>
|
|
|
|
expect(auth(undefined, {}), 'to satisfy', {
|
|
|
|
isSwitcherEnabled: true
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
it('should enable switcher', () => {
|
|
|
|
const expectedValue = true;
|
|
|
|
|
|
|
|
expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
|
|
|
|
isSwitcherEnabled: expectedValue
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should disable switcher', () => {
|
|
|
|
const expectedValue = false;
|
|
|
|
|
|
|
|
expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
|
|
|
|
isSwitcherEnabled: expectedValue
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-11-13 02:01:44 +05:30
|
|
|
});
|