summaryrefslogtreecommitdiffhomepage
path: root/test/components/Settings.spec.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-06-01 16:13:10 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-06-05 12:11:55 +0200
commitca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087 (patch)
treeb1f7754eb50896ab3681e35fa4e08be642b940c9 /test/components/Settings.spec.js
parent5852c980980de53e00d76a0bdb4b41bf5c0f5b39 (diff)
downloadmullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.tar.xz
mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.zip
Add formatted source code
Diffstat (limited to 'test/components/Settings.spec.js')
-rw-r--r--test/components/Settings.spec.js42
1 files changed, 21 insertions, 21 deletions
diff --git a/test/components/Settings.spec.js b/test/components/Settings.spec.js
index 8f0e4a73d4..447b0b50db 100644
--- a/test/components/Settings.spec.js
+++ b/test/components/Settings.spec.js
@@ -17,23 +17,23 @@ describe('components/Settings', () => {
accountHistory: [],
expiry: null,
status: 'none',
- error: null
+ error: null,
};
const loggedInAccountState: AccountReduxState = {
accountToken: '1234',
accountHistory: [],
- expiry: (new Date('2038-01-01')).toISOString(),
+ expiry: new Date('2038-01-01').toISOString(),
status: 'ok',
- error: null
+ error: null,
};
const unpaidAccountState: AccountReduxState = {
accountToken: '1234',
accountHistory: [],
- expiry: (new Date('2001-01-01')).toISOString(),
+ expiry: new Date('2001-01-01').toISOString(),
status: 'ok',
- error: null
+ error: null,
};
const settingsState: SettingsReduxState = {
@@ -48,7 +48,11 @@ describe('components/Settings', () => {
allowLan: false,
};
- const makeProps = (anAccountState: AccountReduxState, aSettingsState: SettingsReduxState, mergeProps: $Shape<SettingsProps> = {}): SettingsProps => {
+ const makeProps = (
+ anAccountState: AccountReduxState,
+ aSettingsState: SettingsReduxState,
+ mergeProps: $Shape<SettingsProps> = {},
+ ): SettingsProps => {
const defaultProps: SettingsProps = {
account: anAccountState,
settings: aSettingsState,
@@ -59,7 +63,7 @@ describe('components/Settings', () => {
onViewSupport: () => {},
onViewAdvancedSettings: () => {},
onViewPreferences: () => {},
- onExternalLink: (_type) => {}
+ onExternalLink: (_type) => {},
};
return Object.assign({}, defaultProps, mergeProps);
};
@@ -120,7 +124,7 @@ describe('components/Settings', () => {
it('should call close callback', (done) => {
const props = makeProps(loggedOutAccountState, settingsState, {
- onClose: () => done()
+ onClose: () => done(),
});
const component = getComponent(render(props), 'settings__close');
click(component);
@@ -128,7 +132,7 @@ describe('components/Settings', () => {
it('should call quit callback', (done) => {
const props = makeProps(loggedOutAccountState, settingsState, {
- onQuit: () => done()
+ onQuit: () => done(),
});
const component = getComponent(render(props), 'settings__quit');
click(component);
@@ -136,7 +140,7 @@ describe('components/Settings', () => {
it('should call account callback', (done) => {
const props = makeProps(loggedInAccountState, settingsState, {
- onViewAccount: () => done()
+ onViewAccount: () => done(),
});
const component = getComponent(render(props), 'settings__account_paid_until_button');
click(component);
@@ -144,7 +148,7 @@ describe('components/Settings', () => {
it('should call advanced settings callback', (done) => {
const props = makeProps(loggedInAccountState, settingsState, {
- onViewAdvancedSettings: () => done()
+ onViewAdvancedSettings: () => done(),
});
const component = getComponent(render(props), 'settings__advanced');
click(component);
@@ -152,7 +156,7 @@ describe('components/Settings', () => {
it('should call preferences callback', (done) => {
const props = makeProps(loggedInAccountState, settingsState, {
- onViewPreferences: () => done()
+ onViewPreferences: () => done(),
});
const component = getComponent(render(props), 'settings__preferences');
click(component);
@@ -160,7 +164,7 @@ describe('components/Settings', () => {
it('should call support callback', (done) => {
const props = makeProps(loggedInAccountState, settingsState, {
- onViewSupport: () => done()
+ onViewSupport: () => done(),
});
const component = getComponent(render(props), 'settings__view_support');
click(component);
@@ -171,25 +175,21 @@ describe('components/Settings', () => {
const props = makeProps(loggedOutAccountState, settingsState, {
onExternalLink: (type) => {
collectedExternalLinkTypes.push(type);
- }
+ },
});
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) => click(element));
expect(collectedExternalLinkTypes).to.include.ordered.members(['faq', 'guides']);
});
-
});
function render(props) {
- return shallow(
- <Settings {...props} />
- );
+ return shallow(<Settings {...props} />);
}
function getComponent(container, testName) {
- return container.findWhere( n => n.prop('testName') === testName);
+ return container.findWhere((n) => n.prop('testName') === testName);
}
function click(component) {