summaryrefslogtreecommitdiffhomepage
path: root/test/helpers/IpcChain.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-06-20 15:34:40 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-07-03 13:37:54 +0200
commit73840e98952dd3f7c005fcec44c971455da179eb (patch)
tree15a887410858007a802450ad2870d8bf495dd16d /test/helpers/IpcChain.js
parent67e82627564f8e4a2d8da4bcf5f0fd00867876bc (diff)
downloadmullvadvpn-73840e98952dd3f7c005fcec44c971455da179eb.tar.xz
mullvadvpn-73840e98952dd3f7c005fcec44c971455da179eb.zip
Refactor IpcFacade to DaemonRpc and JsonRpcWs to JsonRpcTransport
Diffstat (limited to 'test/helpers/IpcChain.js')
-rw-r--r--test/helpers/IpcChain.js18
1 files changed, 9 insertions, 9 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;
}
}