diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-11-16 09:32:24 +0100 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-11-20 10:54:17 +0100 |
| commit | fc28970c6382755d536bf485d81929281e5653bf (patch) | |
| tree | 9c87bf1d3c3be4e377bd9dbb75416abc779094b0 /test | |
| parent | 258eb7a91ef65d3f1692718c5d8a14b2eab12b78 (diff) | |
| download | mullvadvpn-fc28970c6382755d536bf485d81929281e5653bf.tar.xz mullvadvpn-fc28970c6382755d536bf485d81929281e5653bf.zip | |
Always connect to the server set in the settings
Diffstat (limited to 'test')
| -rw-r--r-- | test/auth.spec.js | 4 | ||||
| -rw-r--r-- | test/helpers/ipc-helpers.js | 9 | ||||
| -rw-r--r-- | test/mocks/redux.js | 19 |
3 files changed, 9 insertions, 23 deletions
diff --git a/test/auth.spec.js b/test/auth.spec.js index c3fd78c83d..fa500bd8e3 100644 --- a/test/auth.spec.js +++ b/test/auth.spec.js @@ -29,7 +29,7 @@ describe('authentication', () => { const backend = new Backend(store, credentials, mockIpc); - backend.connect(); + backend.connect('example.com'); }); it('reauthenticates on reconnect', (done) => { @@ -48,7 +48,7 @@ describe('authentication', () => { }, done); - backend.connect(); + backend.connect('example.com'); checkNextTick(() => { expect(authCount).to.equal(1); }, done); diff --git a/test/helpers/ipc-helpers.js b/test/helpers/ipc-helpers.js index e2a578973b..2a2dd1e6b8 100644 --- a/test/helpers/ipc-helpers.js +++ b/test/helpers/ipc-helpers.js @@ -4,7 +4,7 @@ import { Backend } from '../../app/lib/backend'; import { newMockIpc } from '../mocks/ipc'; import configureStore from '../../app/redux/store'; import { createMemoryHistory } from 'history'; -import { mockState, mockStore } from '../mocks/redux'; +import { mockStore } from '../mocks/redux'; type DoneCallback = (?mixed) => void; type Check = () => void; @@ -32,7 +32,7 @@ export function setupBackendAndStore() { } export function setupBackendAndMockStore() { - const store = mockStore(mockState()); + const store = mockStore(_initialState()); const mockIpc = newMockIpc(); const credentials = { sharedSecret: '', @@ -42,6 +42,11 @@ export function setupBackendAndMockStore() { return { store, mockIpc, backend }; } +function _initialState() { + const { store } = setupIpcAndStore(); + return store.getState(); +} + // chai and async aren't the best of friends. To allow us // to get the assertion error in the output of failed async // tests we need to do this try-catch thing. diff --git a/test/mocks/redux.js b/test/mocks/redux.js index 71dafc7f1f..5f0562c035 100644 --- a/test/mocks/redux.js +++ b/test/mocks/redux.js @@ -1,27 +1,8 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -import { defaultServer } from '../../app/config'; const middlewares = [ thunk ]; export const mockStore = configureMockStore(middlewares); -export const mockState = () => { - return { - account: { - accountToken: null, - status: 'none', - error: null - }, - connection: { - status: 'disconnected', - serverAddress: null, - clientIp: null - }, - settings: { - autoSecure: false, - preferredServer: defaultServer - } - }; -}; export const filterMinorActions = (actions) => { return actions.filter((action) => { |
