diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-07-27 10:47:34 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-27 10:47:34 +0200 |
| commit | d74e2ea32c5baa3a137359c0bb99cc8727e38c6c (patch) | |
| tree | 87eeed3f25cf375b24c26f4a277d039ff8755ae8 /test | |
| parent | d5727bb887e87c0c2966f0765e82ca7ad50227ea (diff) | |
| parent | f7a79d6690f464e330abf791da31c2078c05b112 (diff) | |
| download | mullvadvpn-d74e2ea32c5baa3a137359c0bb99cc8727e38c6c.tar.xz mullvadvpn-d74e2ea32c5baa3a137359c0bb99cc8727e38c6c.zip | |
Merge branch 'remove-redux-actions'
Diffstat (limited to 'test')
| -rw-r--r-- | test/reducers.spec.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/reducers.spec.js b/test/reducers.spec.js index 5a0ec8f0a7..23a8e91f89 100644 --- a/test/reducers.spec.js +++ b/test/reducers.spec.js @@ -5,45 +5,47 @@ 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'; +import { BackendError } from '../app/lib/backend'; describe('reducers', () => { + const previousState: any = {}; it('should handle USER_LOGIN_CHANGE', () => { const action = { - type: 'USER_LOGIN_CHANGE', - payload: { - account: '1111', + type: 'LOGIN_CHANGE', + newData: { + accountNumber: '1111', status: 'failed', - error: new Error('Something went wrong') + error: new BackendError('INVALID_ACCOUNT') } }; - const test = Object.assign({}, action.payload); - expect(accountReducer({}, action)).to.deep.equal(test); + const test = Object.assign({}, action.newData); + expect(accountReducer(previousState, action)).to.deep.equal(test); }); it('should handle CONNECTION_CHANGE', () => { const action = { type: 'CONNECTION_CHANGE', - payload: { + newData: { 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); + const test = Object.assign({}, action.newData); + expect(connectionReducer(previousState, action)).to.deep.equal(test); }); it('should handle SETTINGS_UPDATE', () => { const action = { - type: 'SETTINGS_UPDATE', - payload: { + type: 'UPDATE_SETTINGS', + newSettings: { autoSecure: true, preferredServer: defaultServer } }; - const test = Object.assign({}, action.payload); - expect(settingsReducer({}, action)).to.deep.equal(test); + const test = Object.assign({}, action.newSettings); + expect(settingsReducer(previousState, action)).to.deep.equal(test); }); }); |
