mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#48: reset accounts state on logout
This commit is contained in:
@@ -2,7 +2,14 @@ import expect from 'unexpected';
|
||||
|
||||
import accounts from 'services/api/accounts';
|
||||
import authentication from 'services/api/authentication';
|
||||
import { authenticate, revoke, add, activate, remove, ADD, REMOVE, ACTIVATE } from 'components/accounts/actions';
|
||||
import {
|
||||
authenticate,
|
||||
revoke,
|
||||
add, ADD,
|
||||
activate, ACTIVATE,
|
||||
remove,
|
||||
reset
|
||||
} from 'components/accounts/actions';
|
||||
import { SET_LOCALE } from 'components/i18n/actions';
|
||||
|
||||
import { updateUser } from 'components/user/actions';
|
||||
@@ -152,6 +159,9 @@ describe('components/accounts/actions', () => {
|
||||
{payload: {isGuest: true}}
|
||||
// updateUser({isGuest: true})
|
||||
]);
|
||||
expect(dispatch, 'to have a call satisfying', [
|
||||
reset()
|
||||
]);
|
||||
// expect(dispatch, 'to have calls satisfying', [
|
||||
// [remove(account)],
|
||||
// [expect.it('to be a function')]
|
||||
|
||||
@@ -2,8 +2,8 @@ import expect from 'unexpected';
|
||||
|
||||
import accounts from 'components/accounts/reducer';
|
||||
import {
|
||||
updateToken, add, remove, activate,
|
||||
ADD, REMOVE, ACTIVATE, UPDATE_TOKEN
|
||||
updateToken, add, remove, activate, reset,
|
||||
ADD, REMOVE, ACTIVATE, UPDATE_TOKEN, RESET
|
||||
} from 'components/accounts/actions';
|
||||
|
||||
const account = {
|
||||
@@ -94,6 +94,13 @@ describe('Accounts reducer', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe(RESET, () => {
|
||||
it('should reset accounts state', () =>
|
||||
expect(accounts({...initial, available: [account]}, reset()),
|
||||
'to equal', initial)
|
||||
);
|
||||
});
|
||||
|
||||
describe(UPDATE_TOKEN, () => {
|
||||
it('should update token', () => {
|
||||
const newToken = 'newToken';
|
||||
|
||||
Reference in New Issue
Block a user