summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-12-26 12:49:17 +0100
committerAndrej Mihajlov <and@mullvad.net>2018-01-03 12:02:50 +0100
commitca6b1a44aaf75a3426e3a44e3b354f40fe311fb2 (patch)
tree371a9da965f4ee46201a1f1a6f77ae9317c73feb
parente40570935bf6109d6146311aca305eb4cad5debb (diff)
downloadmullvadvpn-ca6b1a44aaf75a3426e3a44e3b354f40fe311fb2.tar.xz
mullvadvpn-ca6b1a44aaf75a3426e3a44e3b354f40fe311fb2.zip
Add test for preferences item
-rw-r--r--app/components/Settings.js2
-rw-r--r--test/components/Settings.spec.js10
2 files changed, 11 insertions, 1 deletions
diff --git a/app/components/Settings.js b/app/components/Settings.js
index a56b516f7e..b9044e49a8 100644
--- a/app/components/Settings.js
+++ b/app/components/Settings.js
@@ -77,7 +77,7 @@ export default class Settings extends Component {
) : null}
{isLoggedIn ? (
- <Button onPress={ this.props.onViewPreferences }>
+ <Button onPress={ this.props.onViewPreferences } testName='settings__preferences'>
<View style={styles.settings__cell}>
<Text style={styles.settings__cell_label}>Preferences</Text>
<Img style={styles.settings__cell_disclosure} source='icon-chevron' tintColor='currentColor' />
diff --git a/test/components/Settings.spec.js b/test/components/Settings.spec.js
index f80c991f34..415be57fd2 100644
--- a/test/components/Settings.spec.js
+++ b/test/components/Settings.spec.js
@@ -45,6 +45,7 @@ describe('components/Settings', () => {
},
},
relayLocations: [],
+ allowLan: false,
};
const makeProps = (anAccountState: AccountReduxState, aSettingsState: SettingsReduxState, mergeProps: $Shape<SettingsProps> = {}): SettingsProps => {
@@ -56,6 +57,7 @@ describe('components/Settings', () => {
onViewAccount: () => {},
onViewSupport: () => {},
onViewAdvancedSettings: () => {},
+ onViewPreferences: () => {},
onExternalLink: (_type) => {}
};
return Object.assign({}, defaultProps, mergeProps);
@@ -147,6 +149,14 @@ describe('components/Settings', () => {
click(component);
});
+ it('should call preferences callback', (done) => {
+ const props = makeProps(loggedInAccountState, settingsState, {
+ onViewPreferences: () => done()
+ });
+ const component = getComponent(render(props), 'settings__preferences');
+ click(component);
+ });
+
it('should call support callback', (done) => {
const props = makeProps(loggedInAccountState, settingsState, {
onViewSupport: () => done()