diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-06-01 16:13:10 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-06-05 12:11:55 +0200 |
| commit | ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087 (patch) | |
| tree | b1f7754eb50896ab3681e35fa4e08be642b940c9 /test/components/SelectLocation.spec.js | |
| parent | 5852c980980de53e00d76a0bdb4b41bf5c0f5b39 (diff) | |
| download | mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.tar.xz mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.zip | |
Add formatted source code
Diffstat (limited to 'test/components/SelectLocation.spec.js')
| -rw-r--r-- | test/components/SelectLocation.spec.js | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/test/components/SelectLocation.spec.js b/test/components/SelectLocation.spec.js index 4e2265c6dd..8310d52b97 100644 --- a/test/components/SelectLocation.spec.js +++ b/test/components/SelectLocation.spec.js @@ -15,47 +15,53 @@ describe('components/SelectLocation', () => { location: 'any', protocol: 'any', port: 'any', - } + }, }, - relayLocations: [{ - name: 'Sweden', - code: 'se', - hasActiveRelays: true, - cities: [{ - name: 'Malmö', - code: 'mma', - latitude: 0, - longitude: 0, + relayLocations: [ + { + name: 'Sweden', + code: 'se', hasActiveRelays: true, - }, { - name: 'Stockholm', - code: 'sto', - latitude: 0, - longitude: 0, - hasActiveRelays: true, - }], - }], + cities: [ + { + name: 'Malmö', + code: 'mma', + latitude: 0, + longitude: 0, + hasActiveRelays: true, + }, + { + name: 'Stockholm', + code: 'sto', + latitude: 0, + longitude: 0, + hasActiveRelays: true, + }, + ], + }, + ], allowLan: false, }; - const makeProps = (state: SettingsReduxState, mergeProps: $Shape<SelectLocationProps>): SelectLocationProps => { + const makeProps = ( + state: SettingsReduxState, + mergeProps: $Shape<SelectLocationProps>, + ): SelectLocationProps => { const defaultProps: SelectLocationProps = { settings: state, onClose: () => {}, - onSelect: (_server) => {} + onSelect: (_server) => {}, }; return Object.assign({}, defaultProps, mergeProps); }; const render = (props: SelectLocationProps) => { - return shallow( - <SelectLocation { ...props } /> - ); + return shallow(<SelectLocation {...props} />); }; it('should call close callback', (done) => { const props = makeProps(state, { - onClose: () => done() + onClose: () => done(), }); const node = getComponent(render(props), 'close'); click(node); @@ -66,13 +72,13 @@ describe('components/SelectLocation', () => { onSelect: (location) => { try { expect(location).to.deep.equal({ - country: 'se' + country: 'se', }); done(); - } catch(e) { + } catch (e) { done(e); } - } + }, }); const elements = getComponent(render(props), 'country'); expect(elements).to.have.length(1); @@ -84,23 +90,22 @@ describe('components/SelectLocation', () => { onSelect: (location) => { try { expect(location).to.deep.equal({ - city: ['se', 'mma'] + city: ['se', 'mma'], }); done(); - } catch(e) { + } catch (e) { done(e); } - } + }, }); const elements = getComponent(render(props), 'city'); expect(elements).to.have.length(2); click(elements.at(0)); }); - }); function getComponent(container, testName) { - return container.findWhere( n => n.prop('testName') === testName); + return container.findWhere((n) => n.prop('testName') === testName); } function click(component) { |
