summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-07-25 13:28:05 +0200
committerErik Larkö <erik@mullvad.net>2017-08-08 09:50:58 +0200
commit3ec32f23e93c8a487da82db86516ad12782b54f6 (patch)
tree1ca272253ff2b242bca265c13dd4b3c260bc62a7 /test
parentd375be8e56975d57f1ca67f28459609de6c10fa5 (diff)
downloadmullvadvpn-3ec32f23e93c8a487da82db86516ad12782b54f6.tar.xz
mullvadvpn-3ec32f23e93c8a487da82db86516ad12782b54f6.zip
Added NEW_LOCATION action
Diffstat (limited to 'test')
-rw-r--r--test/connection-info.spec.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/test/connection-info.spec.js b/test/connection-info.spec.js
index 16600d4389..76a97a35f7 100644
--- a/test/connection-info.spec.js
+++ b/test/connection-info.spec.js
@@ -8,12 +8,39 @@ import connectionActions from '../app/redux/connection/actions';
describe('The connection state', () => {
it('should contain the latest IP', () => {
- const memoryHistory = createMemoryHistory();
- const store = configureStore(null, memoryHistory);
+ const store = createStore();
store.dispatch(connectionActions.newPublicIp('1.2.3.4'));
store.dispatch(connectionActions.newPublicIp('5.6.7.8'));
expect(store.getState().connection.clientIp).to.equal('5.6.7.8');
});
+
+ it('should contain the latest location', () => {
+ const store = createStore();
+
+ const firstLoc = {
+ location: [1, 2],
+ city: 'a',
+ country: 'b',
+ };
+ const secondLoc = {
+ location: [3, 4],
+ city: 'c',
+ country: 'd',
+ };
+
+ store.dispatch(connectionActions.newLocation(firstLoc));
+ store.dispatch(connectionActions.newLocation(secondLoc));
+
+ const { location, city, country } = store.getState().connection;
+ expect(location).to.equal(secondLoc.location);
+ expect(city).to.equal(secondLoc.city);
+ expect(country).to.equal(secondLoc.country);
+ });
});
+
+function createStore() {
+ const memoryHistory = createMemoryHistory();
+ return configureStore(null, memoryHistory);
+}