summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-09-12 14:17:56 +0300
committerAndrej Mihajlov <and@mullvad.net>2018-09-13 12:48:30 +0300
commitea26bb7cfd17078f0c1a60e91eb109da571bb870 (patch)
tree5ef9e597fa098695eba0f31eb450fa9133abdd68
parent932a3be6779f322f3cc41cdc83d6db70aa6b46e8 (diff)
downloadmullvadvpn-ea26bb7cfd17078f0c1a60e91eb109da571bb870.tar.xz
mullvadvpn-ea26bb7cfd17078f0c1a60e91eb109da571bb870.zip
Add missing test for relay selection callback
-rw-r--r--gui/packages/desktop/test/components/SelectLocation.spec.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/gui/packages/desktop/test/components/SelectLocation.spec.js b/gui/packages/desktop/test/components/SelectLocation.spec.js
index 7ddc378257..f4aaf83ba1 100644
--- a/gui/packages/desktop/test/components/SelectLocation.spec.js
+++ b/gui/packages/desktop/test/components/SelectLocation.spec.js
@@ -34,6 +34,13 @@ describe('components/SelectLocation', () => {
includeInCountry: true,
weight: 1,
},
+ {
+ hostname: 'fake2.mullvad.net',
+ ipv4AddrIn: '192.168.0.101',
+ ipv4AddrExit: '192.168.1.101',
+ includeInCountry: true,
+ weight: 1,
+ },
],
},
{
@@ -110,6 +117,27 @@ describe('components/SelectLocation', () => {
expect(elements).to.have.length(2);
elements.at(0).simulate('press');
});
+
+ it('should call select callback for relay', (done) => {
+ const props = {
+ ...defaultProps,
+ onClose: () => {},
+ onSelect: (location) => {
+ try {
+ expect(location).to.deep.equal({
+ hostname: ['se', 'mma', 'fake1.mullvad.net'],
+ });
+ done();
+ } catch (e) {
+ done(e);
+ }
+ },
+ };
+ const component = shallow(<SelectLocation {...props} />);
+ const elements = getComponent(component, 'relay');
+ expect(elements).to.have.length(2);
+ elements.at(0).simulate('press');
+ });
});
function getComponent(container, testName) {