summaryrefslogtreecommitdiffhomepage
path: root/test/components
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-08-22 13:45:37 +0200
committerErik Larkö <erik@mullvad.net>2017-08-23 14:20:10 +0200
commitccd5dda6f107ff57078ac6d080d65637bd3ccf79 (patch)
treecd915fda580ccc7647f25f725983c0ee54deb4f7 /test/components
parentfb1f92d111cd752a6b9edafc8dff58d5b8a59042 (diff)
downloadmullvadvpn-ccd5dda6f107ff57078ac6d080d65637bd3ccf79.tar.xz
mullvadvpn-ccd5dda6f107ff57078ac6d080d65637bd3ccf79.zip
Refactor Connect props and first disconnected test
Diffstat (limited to 'test/components')
-rw-r--r--test/components/Connect.spec.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/components/Connect.spec.js b/test/components/Connect.spec.js
new file mode 100644
index 0000000000..13700e8cca
--- /dev/null
+++ b/test/components/Connect.spec.js
@@ -0,0 +1,56 @@
+// @flow
+
+import { expect } from 'chai';
+import React from 'react';
+import { mount } from 'enzyme';
+
+import Connect from '../../app/components/Connect';
+import Header from '../../app/components/HeaderBar';
+
+describe('components/Connect', () => {
+
+ it('shows unsecured hints when not connected', () => {
+ const component = mount( <Connect {...defaultProps} /> );
+
+ const header = component.find(Header);
+ const securityMessage = component.find('.connect__status-security--unsecured');
+ const connectButton = component.find('.button .button--positive');
+
+ expect(header.prop('style')).to.equal('error');
+ expect(securityMessage.text().toLowerCase()).to.contain('unsecured');
+ expect(connectButton.text()).to.equal('Secure my connection');
+ });
+});
+
+const noop = () => {};
+const defaultServer = {
+ address: '',
+ name: '',
+ city: '',
+ country: '',
+ location: [0, 0],
+};
+const defaultConnection = {
+ status: 'disconnected',
+ isOnline: true,
+ serverAddress: null,
+ clientIp: null,
+ location: null,
+ country: null,
+ city: null,
+};
+
+const defaultProps = {
+ onSettings: noop,
+ onSelectLocation: noop,
+ onConnect: noop,
+ onCopyIP: noop,
+ onDisconnect: noop,
+ onExternalLink: noop,
+ getServerInfo: (_) => { return defaultServer; },
+
+ accountPaidUntil: '',
+ preferredServer: '',
+ connection: defaultConnection,
+};
+