diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-09-13 15:04:38 +0300 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-09-13 16:17:35 +0300 |
| commit | ff84769fefc87a7ce2806a65b043d16a9dfd7d87 (patch) | |
| tree | d22322c9a0a34da42b413f31401b07aa0ba2731b | |
| parent | c2a547f0d07add5acd229954548a2f254801c605 (diff) | |
| download | mullvadvpn-ff84769fefc87a7ce2806a65b043d16a9dfd7d87.tar.xz mullvadvpn-ff84769fefc87a7ce2806a65b043d16a9dfd7d87.zip | |
Add tests
| -rw-r--r-- | gui/packages/desktop/test/components/Connect.spec.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gui/packages/desktop/test/components/Connect.spec.js b/gui/packages/desktop/test/components/Connect.spec.js index 5b745fa294..57fd93229f 100644 --- a/gui/packages/desktop/test/components/Connect.spec.js +++ b/gui/packages/desktop/test/components/Connect.spec.js @@ -40,6 +40,23 @@ describe('components/Connect', () => { expect(disconnectButton.html()).to.contain('Disconnect'); }); + it('shows blocked hints when blocked', () => { + const component = renderWithProps({ + connection: { + ...defaultProps.connection, + status: 'blocked', + blockReason: 'no_matching_relay', + }, + }); + + const header = getComponent(component, 'header'); + const securityMessage = getComponent(component, 'networkSecurityMessage'); + const cancelButton = getComponent(component, 'cancel'); + expect(header.prop('barStyle')).to.equal('success'); + expect(securityMessage.html()).to.contain('BLOCKED '); + expect(cancelButton.html()).to.contain('Cancel'); + }); + it('shows the connection location when connecting', () => { const component = renderWithProps({ connection: { @@ -47,6 +64,7 @@ describe('components/Connect', () => { status: 'connecting', country: 'Norway', city: 'Oslo', + ip: '4.3.2.1', }, }); const countryAndCity = getComponent(component, 'location'); @@ -105,6 +123,47 @@ describe('components/Connect', () => { connectButton.prop('onPress')(); }); + + it('hides the blocking internet message when connected, disconnecting or disconnected', () => { + for (const status of ['connected', 'disconnecting', 'disconnected']) { + const component = renderWithProps({ + connection: { + ...defaultProps.connection, + status, + }, + }); + const blockingAccordion = getComponent(component, 'blockingAccordion'); + + expect(blockingAccordion.prop('height')).to.equal(0); + } + }); + + it('shows the blocking internet message when connecting', () => { + const component = renderWithProps({ + connection: { + ...defaultProps.connection, + status: 'connecting', + country: 'Norway', + city: 'Oslo', + }, + }); + const blockingAccordion = getComponent(component, 'blockingAccordion'); + + expect(blockingAccordion.prop('height')).to.equal('auto'); + }); + + it('shows the blocking internet message when blocked', () => { + const component = renderWithProps({ + connection: { + ...defaultProps.connection, + status: 'blocked', + blockReason: 'no_matching_relay', + }, + }); + const blockingAccordion = getComponent(component, 'blockingAccordion'); + expect(blockingAccordion.prop('height')).to.equal('auto'); + expect(blockingAccordion.dive().html()).to.contain('No relay server'); + }); }); const defaultProps: ConnectProps = { @@ -123,6 +182,7 @@ const defaultProps: ConnectProps = { longitude: null, country: null, city: null, + blockReason: null, }, updateAccountExpiry: () => Promise.resolve(), }; |
