diff options
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); }); }); |
