diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-06-01 16:13:10 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-06-05 12:11:55 +0200 |
| commit | ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087 (patch) | |
| tree | b1f7754eb50896ab3681e35fa4e08be642b940c9 /test/helpers | |
| parent | 5852c980980de53e00d76a0bdb4b41bf5c0f5b39 (diff) | |
| download | mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.tar.xz mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.zip | |
Add formatted source code
Diffstat (limited to 'test/helpers')
| -rw-r--r-- | test/helpers/IpcChain.js | 2 | ||||
| -rw-r--r-- | test/helpers/dom-events.js | 4 | ||||
| -rw-r--r-- | test/helpers/ipc-helpers.js | 13 |
3 files changed, 9 insertions, 10 deletions
diff --git a/test/helpers/IpcChain.js b/test/helpers/IpcChain.js index 4e3ddea79e..44a1c7b0d7 100644 --- a/test/helpers/IpcChain.js +++ b/test/helpers/IpcChain.js @@ -25,7 +25,7 @@ export class IpcChain { _addStep<R>(step: StepBuilder<R>) { const me = this; this._mockIpc[step.ipcCall] = function() { - return new Promise(r => me._stepPromiseCallback(step, r, arguments)); + return new Promise((r) => me._stepPromiseCallback(step, r, arguments)); }; } diff --git a/test/helpers/dom-events.js b/test/helpers/dom-events.js index 6d5b069e08..2d8b4be3cf 100644 --- a/test/helpers/dom-events.js +++ b/test/helpers/dom-events.js @@ -12,11 +12,11 @@ const keycodes = { '0': { which: 48, keyCode: 48 }, Tab: { which: 9, keyCode: 9 }, Enter: { which: 13, keyCode: 13 }, - Backspace: { which: 8, keyCode: 8 } + Backspace: { which: 8, keyCode: 8 }, }; export type Keycode = $Keys<typeof keycodes>; export function createKeyEvent(key: Keycode): Object { - return Object.assign({}, { key }, keycodes[key], {preventDefault: () => {}}); //preventDefault is needed to mock key events for onKeyPress in AccountInput + return Object.assign({}, { key }, keycodes[key], { preventDefault: () => {} }); //preventDefault is needed to mock key events for onKeyPress in AccountInput } diff --git a/test/helpers/ipc-helpers.js b/test/helpers/ipc-helpers.js index 3f8307ccf3..4466c06eb2 100644 --- a/test/helpers/ipc-helpers.js +++ b/test/helpers/ipc-helpers.js @@ -19,7 +19,6 @@ export function setupIpcAndStore() { } export function setupBackendAndStore() { - const { store, mockIpc } = setupIpcAndStore(); const credentials = { @@ -69,7 +68,6 @@ export function checkNextTick(fn: Check, done: DoneCallback) { }, 1); } - // In async tests where we want to test a chain of IPC messages // we can only invoke `done` for the last message. This function // is for the intermediate messages. @@ -77,7 +75,7 @@ export function failFast(fn: Check, done: DoneCallback): boolean { try { fn(); return false; - } catch(e) { + } catch (e) { done(e); return true; } @@ -89,17 +87,18 @@ export function failFastNextTick(fn: Check, done: DoneCallback) { } type MockStore = { - getActions: () => Array<{type: string, payload: Object}>, -} + getActions: () => Array<{ type: string, payload: Object }>, +}; // Parses the action log to find out which URL we most recently navigated to // Note that this cannot be done with the real redux store, but rather must be // done with the mock store. export function getLocation(store: MockStore): ?string { - const navigations = store.getActions().filter(action => action.type === '@@router/CALL_HISTORY_METHOD'); + const navigations = store + .getActions() + .filter((action) => action.type === '@@router/CALL_HISTORY_METHOD'); if (navigations.length === 0) { return null; } return navigations[navigations.length - 1].payload.args[0]; } - |
