diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-07-23 16:29:19 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-07-23 16:29:19 +0200 |
| commit | 858c95cdf3bb94ff4e75eb63c8c982520a5fb629 (patch) | |
| tree | 850e39a41014918b89189be2c62283b78c099161 /test/components/Settings.spec.js | |
| parent | 7a72cd6f6768716f9c38923cb6a668b81209d617 (diff) | |
| download | mullvadvpn-858c95cdf3bb94ff4e75eb63c8c982520a5fb629.tar.xz mullvadvpn-858c95cdf3bb94ff4e75eb63c8c982520a5fb629.zip | |
Fix tests
Diffstat (limited to 'test/components/Settings.spec.js')
| -rw-r--r-- | test/components/Settings.spec.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/test/components/Settings.spec.js b/test/components/Settings.spec.js index 2a152e1cc8..9edf46fcc3 100644 --- a/test/components/Settings.spec.js +++ b/test/components/Settings.spec.js @@ -1,8 +1,9 @@ // @flow import * as React from 'react'; -import Settings from '../../app/components/Settings'; import { shallow } from 'enzyme'; +import Settings from '../../app/components/Settings'; +import { CloseBarItem } from '../../app/components/NavigationBar'; import type { AccountReduxState } from '../../app/redux/account/reducers'; import type { SettingsReduxState } from '../../app/redux/settings/reducers'; @@ -124,8 +125,10 @@ describe('components/Settings', () => { const props = makeProps(loggedOutAccountState, settingsState, { onClose: () => done(), }); - const component = getComponent(render(props), 'settings__close'); - click(component); + const component = render(props) + .find(CloseBarItem) + .dive(); + component.simulate('press'); }); it('should call quit callback', (done) => { @@ -133,7 +136,7 @@ describe('components/Settings', () => { onQuit: () => done(), }); const component = getComponent(render(props), 'settings__quit'); - click(component); + component.simulate('press'); }); it('should call account callback', (done) => { @@ -141,7 +144,7 @@ describe('components/Settings', () => { onViewAccount: () => done(), }); const component = getComponent(render(props), 'settings__account_paid_until_button'); - click(component); + component.simulate('press'); }); it('should call advanced settings callback', (done) => { @@ -149,7 +152,7 @@ describe('components/Settings', () => { onViewAdvancedSettings: () => done(), }); const component = getComponent(render(props), 'settings__advanced'); - click(component); + component.simulate('press'); }); it('should call preferences callback', (done) => { @@ -157,7 +160,7 @@ describe('components/Settings', () => { onViewPreferences: () => done(), }); const component = getComponent(render(props), 'settings__preferences'); - click(component); + component.simulate('press'); }); it('should call support callback', (done) => { @@ -165,7 +168,7 @@ describe('components/Settings', () => { onViewSupport: () => done(), }); const component = getComponent(render(props), 'settings__view_support'); - click(component); + component.simulate('press'); }); it('should call external links callback', () => { @@ -176,7 +179,9 @@ describe('components/Settings', () => { }, }); const container = getComponent(render(props), 'settings__external_link'); - container.find({ testName: 'settings__external_link' }).forEach((element) => click(element)); + container + .find({ testName: 'settings__external_link' }) + .forEach((element) => element.simulate('press')); expect(collectedExternalLinkTypes).to.include.ordered.members(['faq', 'guides']); }); @@ -189,7 +194,3 @@ function render(props) { function getComponent(container, testName) { return container.findWhere((n) => n.prop('testName') === testName); } - -function click(component) { - component.prop('onPress')(); -} |
