diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-06-20 15:34:40 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-07-03 13:37:54 +0200 |
| commit | 73840e98952dd3f7c005fcec44c971455da179eb (patch) | |
| tree | 15a887410858007a802450ad2870d8bf495dd16d /test/helpers | |
| parent | 67e82627564f8e4a2d8da4bcf5f0fd00867876bc (diff) | |
| download | mullvadvpn-73840e98952dd3f7c005fcec44c971455da179eb.tar.xz mullvadvpn-73840e98952dd3f7c005fcec44c971455da179eb.zip | |
Refactor IpcFacade to DaemonRpc and JsonRpcWs to JsonRpcTransport
Diffstat (limited to 'test/helpers')
| -rw-r--r-- | test/helpers/IpcChain.js | 18 | ||||
| -rw-r--r-- | test/helpers/ipc-helpers.js | 14 |
2 files changed, 11 insertions, 21 deletions
diff --git a/test/helpers/IpcChain.js b/test/helpers/IpcChain.js index 1505621cc0..547851fdcf 100644 --- a/test/helpers/IpcChain.js +++ b/test/helpers/IpcChain.js @@ -1,7 +1,5 @@ // @flow -import { check, failFast } from './ipc-helpers'; - export class IpcChain { _expectedCalls: Array<string>; _recordedCalls: Array<string>; @@ -39,12 +37,11 @@ export class IpcChain { const inputValidation = step.inputValidation; if (inputValidation) { - const failedInputValidation = failFast(() => { + try { inputValidation(...args); - }, this._done); - - if (failedInputValidation) { + } catch (error) { this._abort(); + this._done(error); return; } } @@ -65,16 +62,19 @@ export class IpcChain { } _ensureChainCalledCorrectly() { - check(() => { + try { expect(this._expectedCalls).to.deep.equal(this._recordedCalls); - }, this._done); + this._done(); + } catch (error) { + this._done(error); + } } _registerCall(ipcCall: string) { this._recordedCalls.push(ipcCall); } - onSuccessOrFailure(done: (*) => void) { + end(done: (?Error) => void) { this._done = done; } } diff --git a/test/helpers/ipc-helpers.js b/test/helpers/ipc-helpers.js index 4466c06eb2..5bfe1d0267 100644 --- a/test/helpers/ipc-helpers.js +++ b/test/helpers/ipc-helpers.js @@ -12,7 +12,6 @@ type Check = () => void; export function setupIpcAndStore() { const memoryHistory = createMemoryHistory(); const store = configureStore(null, memoryHistory); - const mockIpc = newMockIpc(); return { store, mockIpc }; @@ -20,12 +19,7 @@ export function setupIpcAndStore() { export function setupBackendAndStore() { const { store, mockIpc } = setupIpcAndStore(); - - const credentials = { - sharedSecret: '', - connectionString: '', - }; - const backend = new Backend(store, credentials, mockIpc); + const backend = new Backend(store, mockIpc); return { store, mockIpc, backend }; } @@ -33,11 +27,7 @@ export function setupBackendAndStore() { export function setupBackendAndMockStore() { const store = mockStore(_initialState()); const mockIpc = newMockIpc(); - const credentials = { - sharedSecret: '', - connectionString: '', - }; - const backend = new Backend(store, credentials, mockIpc); + const backend = new Backend(store, mockIpc); return { store, mockIpc, backend }; } |
