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
38
39
40
41
42
43
44
45
46
47
48
49
|
// @flow
import { expect } from 'chai';
import accountReducer from '../app/redux/account/reducers';
import connectionReducer from '../app/redux/connection/reducers';
import settingsReducer from '../app/redux/settings/reducers';
import { defaultServer } from '../app/config';
describe('reducers', () => {
it('should handle USER_LOGIN_CHANGE', () => {
const action = {
type: 'USER_LOGIN_CHANGE',
payload: {
account: '1111',
status: 'failed',
error: new Error('Something went wrong')
}
};
const test = Object.assign({}, action.payload);
expect(accountReducer({}, action)).to.deep.equal(test);
});
it('should handle CONNECTION_CHANGE', () => {
const action = {
type: 'CONNECTION_CHANGE',
payload: {
status: 'connected',
serverAddress: '2.1.1.2',
clientIp: '2.1.1.1'
}
};
const test = Object.assign({}, action.payload);
expect(connectionReducer({}, action)).to.deep.equal(test);
});
it('should handle SETTINGS_UPDATE', () => {
const action = {
type: 'SETTINGS_UPDATE',
payload: {
autoSecure: true,
preferredServer: defaultServer
}
};
const test = Object.assign({}, action.payload);
expect(settingsReducer({}, action)).to.deep.equal(test);
});
});
|