diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/components/Connect.spec.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/test/components/Connect.spec.js b/test/components/Connect.spec.js index 9c280c7308..62da014cd7 100644 --- a/test/components/Connect.spec.js +++ b/test/components/Connect.spec.js @@ -35,7 +35,27 @@ describe('components/Connect', () => { expect(disconnectButton.text()).to.equal('Disconnect'); }); - it('shows the connection location information when connected', () => { + it('shows the connection location when connecting', () => { + const component = renderConnecting({ + getServerInfo: (_s) => ({ + address: '', + name: '', + location: [0, 0], + country: 'norway', + city: 'oslo', + }), + }, { + clientIp: '185.65.132.102', + }); + const countryAndCity = component.find('.connect__status-location'); + const ipAddr = component.find('.connect__status-ipaddress'); + + expect(countryAndCity.text()).to.contain('norway'); + expect(countryAndCity.text()).not.to.contain('oslo'); + expect(ipAddr.text()).to.be.empty; + }); + + it('shows the connection location when connected', () => { const component = renderConnected({ getServerInfo: (_s) => ({ address: '', @@ -55,7 +75,7 @@ describe('components/Connect', () => { expect(ipAddr.text()).to.contain('185.65.132.102'); }); - it('shows the connection location information when disconnected', () => { + it('shows the connection location when disconnected', () => { const component = renderNotConnected({ getServerInfo: (_s) => ({ address: '', @@ -110,6 +130,15 @@ function renderNotConnected(customProps, customConnectionProps) { return renderWithProps(props); } +function renderConnecting(customProps, customConnectionProps) { + const connection = Object.assign({}, defaultConnection, { + status: 'connecting', + }, customConnectionProps); + + const props = Object.assign({}, customProps, {connection}); + return renderWithProps(props); +} + function renderConnected(customProps, customConnectionProps) { const connection = Object.assign({}, defaultConnection, { status: 'connected', |
