diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-06-26 15:19:03 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-03 12:41:51 +0200 |
| commit | 1bb1bdbe31da5c23e4cb2b414a8756c645049998 (patch) | |
| tree | 5d875318d24b327b20da40762b31115c608f0652 /test | |
| parent | 4e8f44c7ef6ffee09d9d3abd70bfd093f87d6b18 (diff) | |
| download | mullvadvpn-1bb1bdbe31da5c23e4cb2b414a8756c645049998.tar.xz mullvadvpn-1bb1bdbe31da5c23e4cb2b414a8756c645049998.zip | |
Moved the redux stuff into separate folder and renamed user->account and connect->connection
Diffstat (limited to 'test')
| -rw-r--r-- | test/actions.spec.js | 21 | ||||
| -rw-r--r-- | test/mocks/redux.js | 4 | ||||
| -rw-r--r-- | test/reducers.spec.js | 12 | ||||
| -rw-r--r-- | test/routing.spec.js | 10 |
4 files changed, 26 insertions, 21 deletions
diff --git a/test/actions.spec.js b/test/actions.spec.js index d1bffe2d5e..683927de86 100644 --- a/test/actions.spec.js +++ b/test/actions.spec.js @@ -1,10 +1,11 @@ // @flow + import { expect } from 'chai'; import { filterMinorActions, mockState, mockStore } from './mocks/redux'; import { Backend } from '../app/lib/backend'; import { newMockIpc } from './mocks/ipc'; -import userActions from '../app/actions/user'; -import connectActions from '../app/actions/connect'; +import accountActions from '../app/redux/account/actions'; +import connectionActions from '../app/redux/connection/actions'; import mapBackendEventsToReduxActions from '../app/lib/backend-redux-actions'; describe('actions', function() { @@ -33,7 +34,7 @@ describe('actions', function() { done(); }); - store.dispatch(userActions.login(backend, '1')); + store.dispatch(accountActions.login(backend, '1')); }); it('should logout', (done) => { @@ -53,7 +54,7 @@ describe('actions', function() { done(); }); - store.dispatch(userActions.logout(backend)); + store.dispatch(accountActions.logout(backend)); }); it('should connect to VPN server', (done) => { @@ -84,9 +85,9 @@ describe('actions', function() { }); backend.once('login', () => { - store.dispatch(connectActions.connect(backend, '1.2.3.4')); + store.dispatch(connectionActions.connect(backend, '1.2.3.4')); }); - store.dispatch(userActions.login(backend, '1')); + store.dispatch(accountActions.login(backend, '1')); }); it('should disconnect from VPN server', (done) => { @@ -95,7 +96,7 @@ describe('actions', function() { ]; let state = Object.assign(mockState(), { - user: { + account: { account: '3333234567890', paidUntil: '2038-01-01T00:00:00.000Z', status: 'ok' @@ -117,7 +118,7 @@ describe('actions', function() { done(); }); - store.dispatch(connectActions.disconnect(backend)); + store.dispatch(connectionActions.disconnect(backend)); }); it('should disconnect from VPN server on logout', (done) => { @@ -127,7 +128,7 @@ describe('actions', function() { ]; let state = Object.assign(mockState(), { - user: { + account: { account: '3333234567890', paidUntil: '2038-01-01T00:00:00.000Z', status: 'ok' @@ -149,7 +150,7 @@ describe('actions', function() { done(); }); - store.dispatch(userActions.logout(backend)); + store.dispatch(accountActions.logout(backend)); }); }); diff --git a/test/mocks/redux.js b/test/mocks/redux.js index 0d4d73518f..d120eafec1 100644 --- a/test/mocks/redux.js +++ b/test/mocks/redux.js @@ -10,12 +10,12 @@ const middlewares = [ thunk ]; export const mockStore = configureMockStore(middlewares); export const mockState = () => { return { - user: { + account: { account: null, status: 'none', error: null }, - connect: { + connection: { status: 'disconnected', serverAddress: null, clientIp: null diff --git a/test/reducers.spec.js b/test/reducers.spec.js index 7a5470e930..5a0ec8f0a7 100644 --- a/test/reducers.spec.js +++ b/test/reducers.spec.js @@ -1,7 +1,9 @@ +// @flow + import { expect } from 'chai'; -import userReducer from '../app/reducers/user'; -import connectReducer from '../app/reducers/connect'; -import settingsReducer from '../app/reducers/settings'; +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', () => { @@ -16,7 +18,7 @@ describe('reducers', () => { } }; const test = Object.assign({}, action.payload); - expect(userReducer({}, action)).to.deep.equal(test); + expect(accountReducer({}, action)).to.deep.equal(test); }); it('should handle CONNECTION_CHANGE', () => { @@ -29,7 +31,7 @@ describe('reducers', () => { } }; const test = Object.assign({}, action.payload); - expect(connectReducer({}, action)).to.deep.equal(test); + expect(connectionReducer({}, action)).to.deep.equal(test); }); it('should handle SETTINGS_UPDATE', () => { diff --git a/test/routing.spec.js b/test/routing.spec.js index 062c1e5246..66fe3e72e3 100644 --- a/test/routing.spec.js +++ b/test/routing.spec.js @@ -1,7 +1,9 @@ +// @flow + import { expect } from 'chai'; import { filterMinorActions, mockState, mockStore } from './mocks/redux'; -import userActions from '../app/actions/user'; +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'; @@ -15,7 +17,7 @@ describe('routing', function() { ]; let state = Object.assign(mockState(), { - user: { + account: { account: '1111234567890', status: 'ok' } @@ -25,7 +27,7 @@ describe('routing', function() { const backend = new Backend(newMockIpc()); mapBackendEventsToRouter(backend, store); - store.dispatch(userActions.logout(backend)); + store.dispatch(accountActions.logout(backend)); setTimeout(() => { const storeActions = filterMinorActions(store.getActions()); @@ -47,7 +49,7 @@ describe('routing', function() { expect(storeActions).deep.equal(expectedActions); done(); }); - store.dispatch(userActions.login(backend, '1')); + store.dispatch(accountActions.login(backend, '1')); }); }); |
