blob: ccb702de8b4e10a5e1578a0a2045114bcdebe09c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// @flow
import { expect } from 'chai';
import { filterMinorActions, mockState, mockStore } from './mocks/redux';
import accountActions from '../app/redux/account/actions';
import mapBackendEventsToRouter from '../app/lib/backend-routing';
import { Backend } from '../app/lib/backend';
import { newMockIpc } from './mocks/ipc';
describe('routing', function() {
this.timeout(10000);
it('should redirect to login screen on logout', () => {
const expectedActions = [
{ type: '@@router/CALL_HISTORY_METHOD', payload: { method: 'replace', args: [ '/' ] } }
];
let state = Object.assign(mockState(), {
account: {
account: '1111234567890',
status: 'ok'
}
});
const store = mockStore(state);
const backend = new Backend(store, newMockIpc());
mapBackendEventsToRouter(backend, store);
store.dispatch(accountActions.logout(backend));
setTimeout(() => {
const storeActions = filterMinorActions(store.getActions());
expect(storeActions).deep.equal(expectedActions);
}, 0);
});
});
|