diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-11-21 15:48:20 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-11-23 12:41:13 +0100 |
| commit | abb6dae7b765755d4c687401384095b44e931279 (patch) | |
| tree | 557b85736b8e746b9842443a21ff164c7d2423d9 | |
| parent | 3f378094189d542cad7deac5b3b919f724c96758 (diff) | |
| download | mullvadvpn-abb6dae7b765755d4c687401384095b44e931279.tar.xz mullvadvpn-abb6dae7b765755d4c687401384095b44e931279.zip | |
Fix flow annotations
| -rw-r--r-- | app/lib/backend.js | 19 | ||||
| -rw-r--r-- | test/mocks/ipc.js | 14 |
2 files changed, 17 insertions, 16 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js index 1b76bc4414..7aa67dc84b 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -315,18 +315,15 @@ export class Backend { syncRelaySettings(): Promise<void> { return this._ensureAuthenticated() - .then( () => { - return this._ipc.getRelaySettings(); - }) - .then( constraints => { - log.debug('Got constraints from backend', constraints); - - const { custom_tunnel_endpoint, normal } = constraints; - - if(normal) { + .then(() => this._ipc.getRelaySettings()) + .then((constraints) => { + log.debug('Got constraints from backend', constraints) + if(constraints.normal) { + const normal = constraints.normal; // TODO: handle normal constraints log.warn('syncRelaySettings: Normal constraints are not implemented yet.'); - } else if(custom_tunnel_endpoint) { + } else if(constraints.custom_tunnel_endpoint) { + const custom_tunnel_endpoint = constraints.custom_tunnel_endpoint; const { host, tunnel: { openvpn } } = custom_tunnel_endpoint; this._store.dispatch(settingsActions.updateRelay({ host: host, @@ -335,7 +332,7 @@ export class Backend { })); } }) - .catch( e => { + .catch(e => { log.error('Failed getting relay constraints', e); }); } diff --git a/test/mocks/ipc.js b/test/mocks/ipc.js index 8b98e9309a..5b3b7ea1ac 100644 --- a/test/mocks/ipc.js +++ b/test/mocks/ipc.js @@ -31,11 +31,15 @@ export function newMockIpc() { updateRelaySettings: () => Promise.resolve(), getRelaySettings: () => Promise.resolve({ - host: { only: 'www.example.com' }, - tunnel: { openvpn: { - port: 'any', - protocol: 'any', - }}, + custom_tunnel_endpoint: { + host: 'www.example.com', + tunnel: { + openvpn: { + port: 1300, + protocol: 'udp', + } + } + }, }), connect: () => Promise.resolve(), |
