diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-28 13:02:17 +0000 |
|---|---|---|
| committer | Andrej Mihajlov <and@codeispoetry.ru> | 2017-02-28 13:02:17 +0000 |
| commit | b75d0e01f2cb002de52b5172cd5196af2ef39b3a (patch) | |
| tree | bea713477d26a73e543604e295755f2275fc0886 /test | |
| parent | 68eb65210dabde8bc138f3d99d85bc93cba5eab4 (diff) | |
| download | mullvadvpn-b75d0e01f2cb002de52b5172cd5196af2ef39b3a.tar.xz mullvadvpn-b75d0e01f2cb002de52b5172cd5196af2ef39b3a.zip | |
Update reducers tests
Diffstat (limited to 'test')
| -rw-r--r-- | test/reducers.spec.js | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/test/reducers.spec.js b/test/reducers.spec.js index 109c0f5619..4d0f3d6833 100644 --- a/test/reducers.spec.js +++ b/test/reducers.spec.js @@ -2,38 +2,44 @@ import { expect } from 'chai'; import userReducer from '../app/reducers/user'; import connectReducer from '../app/reducers/connect'; import settingsReducer from '../app/reducers/settings'; -import userActions from '../app/actions/user'; -import connectActions from '../app/actions/connect'; -import settingsActions from '../app/actions/settings'; import { LoginState, ConnectionState, defaultServer } from '../app/constants'; describe('reducers', () => { it('should handle USER_LOGIN_CHANGE', () => { - const action = userActions.loginChange({ - account: '1111', - status: LoginState.failed, - error: new Error('Something went wrong') - }); + const action = { + type: 'USER_LOGIN_CHANGE', + payload: { + account: '1111', + status: LoginState.failed, + error: new Error('Something went wrong') + } + } const test = Object.assign({}, action.payload); expect(userReducer({}, action)).to.deep.equal(test); }); it('should handle CONNECTION_CHANGE', () => { - const action = connectActions.connectionChange({ - status: ConnectionState.connected, - serverAddress: '2.1.1.2', - clientIp: '2.1.1.1' - }); + const action = { + type: 'CONNECTION_CHANGE', + payload: { + status: ConnectionState.connected, + serverAddress: '2.1.1.2', + clientIp: '2.1.1.1' + } + }; const test = Object.assign({}, action.payload); expect(connectReducer({}, action)).to.deep.equal(test); }); - it('should handle SETTINGS_CHANGE', () => { - const action = settingsActions.updateSettings({ - autoSecure: true, - preferredServer: defaultServer - }); + 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); }); |
