Commit 9180eaee authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 57 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 0fdc1fc0
...@@ -1706,39 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js ...@@ -1706,39 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js spec/frontend/behaviors/secret_values_spec.js
## exciting-driscoll
spec/frontend/droplab/drop_down_spec.js
spec/frontend/droplab/plugins/ajax_filter_spec.js
spec/frontend/editor/editor_lite_extension_base_spec.js
spec/frontend/editor/editor_lite_spec.js
spec/frontend/editor/editor_markdown_ext_spec.js
spec/frontend/emoji/emoji_spec.js
spec/frontend/environment.js
spec/frontend/environments/environment_actions_spec.js
spec/frontend/environments/environment_table_spec.js
spec/frontend/environments/environment_terminal_button_spec.js
spec/frontend/environments/folder/environments_folder_view_spec.js
spec/frontend/error_tracking/components/error_details_spec.js
spec/frontend/error_tracking/components/error_tracking_list_spec.js
spec/frontend/error_tracking/store/actions_spec.js
spec/frontend/error_tracking/store/details/actions_spec.js
spec/frontend/error_tracking/store/list/actions_spec.js
spec/frontend/error_tracking_settings/store/actions_spec.js
spec/frontend/feature_flags/components/configure_feature_flags_modal_spec.js
spec/frontend/feature_flags/components/edit_feature_flag_spec.js
spec/frontend/feature_flags/components/environments_dropdown_spec.js
spec/frontend/feature_flags/components/feature_flags_spec.js
spec/frontend/feature_flags/components/form_spec.js
spec/frontend/feature_flags/components/new_environments_dropdown_spec.js
spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js
spec/frontend/feature_flags/components/user_lists_table_spec.js
spec/frontend/feature_flags/store/edit/actions_spec.js
spec/frontend/feature_flags/store/index/actions_spec.js
spec/frontend/feature_flags/store/index/mutations_spec.js
spec/frontend/feature_flags/store/new/actions_spec.js
spec/frontend/feature_highlight/feature_highlight_helper_spec.js
spec/frontend/filtered_search/components/recent_searches_dropdown_content_spec.js
## determined-blackburn ## determined-blackburn
spec/frontend/filtered_search/filtered_search_manager_spec.js spec/frontend/filtered_search/filtered_search_manager_spec.js
spec/frontend/filtered_search/filtered_search_token_keys_spec.js spec/frontend/filtered_search/filtered_search_token_keys_spec.js
......
...@@ -151,7 +151,7 @@ describe('DropLab DropDown', () => { ...@@ -151,7 +151,7 @@ describe('DropLab DropDown', () => {
}; };
testContext.dummyListItem = document.createElement('li'); testContext.dummyListItem = document.createElement('li');
jest.spyOn(testContext.event.target, 'closest').mockImplementation(selector => { jest.spyOn(testContext.event.target, 'closest').mockImplementation((selector) => {
if (selector === 'li') { if (selector === 'li') {
return testContext.dummyListItem; return testContext.dummyListItem;
} }
...@@ -402,7 +402,7 @@ describe('DropLab DropDown', () => { ...@@ -402,7 +402,7 @@ describe('DropLab DropDown', () => {
beforeEach(() => { beforeEach(() => {
testContext.renderableList = {}; testContext.renderableList = {};
testContext.list = { testContext.list = {
querySelector: q => { querySelector: (q) => {
if (q === '.filter-dropdown-loading') { if (q === '.filter-dropdown-loading') {
return false; return false;
} }
...@@ -414,7 +414,7 @@ describe('DropLab DropDown', () => { ...@@ -414,7 +414,7 @@ describe('DropLab DropDown', () => {
testContext.data = [0, 1]; testContext.data = [0, 1];
testContext.customEvent = {}; testContext.customEvent = {};
jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation(data => data); jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation((data) => data);
jest.spyOn(testContext.list, 'dispatchEvent').mockImplementation(() => {}); jest.spyOn(testContext.list, 'dispatchEvent').mockImplementation(() => {});
jest.spyOn(testContext.data, 'map'); jest.spyOn(testContext.data, 'map');
jest.spyOn(window, 'CustomEvent').mockReturnValue(testContext.customEvent); jest.spyOn(window, 'CustomEvent').mockReturnValue(testContext.customEvent);
...@@ -465,7 +465,7 @@ describe('DropLab DropDown', () => { ...@@ -465,7 +465,7 @@ describe('DropLab DropDown', () => {
testContext.dropdown = { renderChildren: () => {}, list: testContext.list }; testContext.dropdown = { renderChildren: () => {}, list: testContext.list };
testContext.data = [0, 1]; testContext.data = [0, 1];
jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation(data => data); jest.spyOn(testContext.dropdown, 'renderChildren').mockImplementation((data) => data);
jest.spyOn(testContext.list, 'querySelector').mockImplementation(() => {}); jest.spyOn(testContext.list, 'querySelector').mockImplementation(() => {});
jest.spyOn(testContext.data, 'map'); jest.spyOn(testContext.data, 'map');
......
...@@ -28,7 +28,7 @@ describe('AjaxFilter', () => { ...@@ -28,7 +28,7 @@ describe('AjaxFilter', () => {
let ajaxSpy; let ajaxSpy;
beforeEach(() => { beforeEach(() => {
jest.spyOn(AjaxCache, 'retrieve').mockImplementation(url => ajaxSpy(url)); jest.spyOn(AjaxCache, 'retrieve').mockImplementation((url) => ajaxSpy(url));
jest.spyOn(AjaxFilter, '_loadData').mockImplementation(() => {}); jest.spyOn(AjaxFilter, '_loadData').mockImplementation(() => {});
dummyConfig.onLoadingFinished = jest.fn(); dummyConfig.onLoadingFinished = jest.fn();
...@@ -38,8 +38,8 @@ describe('AjaxFilter', () => { ...@@ -38,8 +38,8 @@ describe('AjaxFilter', () => {
dummyList.list.appendChild(dynamicList); dummyList.list.appendChild(dynamicList);
}); });
it('calls onLoadingFinished after loading data', done => { it('calls onLoadingFinished after loading data', (done) => {
ajaxSpy = url => { ajaxSpy = (url) => {
expect(url).toBe('dummy endpoint?dummy search key='); expect(url).toBe('dummy endpoint?dummy search key=');
return Promise.resolve(dummyData); return Promise.resolve(dummyData);
}; };
...@@ -52,16 +52,16 @@ describe('AjaxFilter', () => { ...@@ -52,16 +52,16 @@ describe('AjaxFilter', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not call onLoadingFinished if Ajax call fails', done => { it('does not call onLoadingFinished if Ajax call fails', (done) => {
const dummyError = new Error('My dummy is sick! :-('); const dummyError = new Error('My dummy is sick! :-(');
ajaxSpy = url => { ajaxSpy = (url) => {
expect(url).toBe('dummy endpoint?dummy search key='); expect(url).toBe('dummy endpoint?dummy search key=');
return Promise.reject(dummyError); return Promise.reject(dummyError);
}; };
AjaxFilter.trigger() AjaxFilter.trigger()
.then(done.fail) .then(done.fail)
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(dummyConfig.onLoadingFinished.mock.calls.length).toBe(0); expect(dummyConfig.onLoadingFinished.mock.calls.length).toBe(0);
}) })
......
...@@ -16,7 +16,7 @@ describe('The basis for an Editor Lite extension', () => { ...@@ -16,7 +16,7 @@ describe('The basis for an Editor Lite extension', () => {
if (instance) { if (instance) {
if (options) { if (options) {
Object.entries(options).forEach(prop => { Object.entries(options).forEach((prop) => {
expect(instance[prop]).toBeUndefined(); expect(instance[prop]).toBeUndefined();
}); });
// Both instance and options are passed // Both instance and options are passed
......
...@@ -324,13 +324,13 @@ describe('Base editor', () => { ...@@ -324,13 +324,13 @@ describe('Base editor', () => {
${'multiple simple objects'} | ${[FooObjExt, BarObjExt]} | ${['foo', 'bar']} | ${[fooRes, barRes]} ${'multiple simple objects'} | ${[FooObjExt, BarObjExt]} | ${['foo', 'bar']} | ${[fooRes, barRes]}
${'combination of ES6 classes and objects'} | ${[AlphaExt, BarObjExt]} | ${['alpha', 'bar']} | ${[alphaRes, barRes]} ${'combination of ES6 classes and objects'} | ${[AlphaExt, BarObjExt]} | ${['alpha', 'bar']} | ${[alphaRes, barRes]}
`('is extensible with $type', ({ extensions, methods, expectations } = {}) => { `('is extensible with $type', ({ extensions, methods, expectations } = {}) => {
methods.forEach(method => { methods.forEach((method) => {
expect(instance[method]).toBeUndefined(); expect(instance[method]).toBeUndefined();
}); });
instance.use(extensions); instance.use(extensions);
methods.forEach(method => { methods.forEach((method) => {
expect(instance[method]).toBeDefined(); expect(instance[method]).toBeDefined();
}); });
...@@ -359,7 +359,7 @@ describe('Base editor', () => { ...@@ -359,7 +359,7 @@ describe('Base editor', () => {
it.each([WithStaticMethod, WithStaticMethodExtended])( it.each([WithStaticMethod, WithStaticMethodExtended])(
'properly resolves data for an extension with private data', 'properly resolves data for an extension with private data',
ExtClass => { (ExtClass) => {
const base = 1; const base = 1;
expect(instance.base).toBeUndefined(); expect(instance.base).toBeUndefined();
expect(instance.boo).toBeUndefined(); expect(instance.boo).toBeUndefined();
...@@ -408,7 +408,7 @@ describe('Base editor', () => { ...@@ -408,7 +408,7 @@ describe('Base editor', () => {
}; };
beforeEach(() => { beforeEach(() => {
editorExtensionSpy = jest.spyOn(Editor, 'pushToImportsArray').mockImplementation(arr => { editorExtensionSpy = jest.spyOn(Editor, 'pushToImportsArray').mockImplementation((arr) => {
arr.push( arr.push(
Promise.resolve({ Promise.resolve({
default: {}, default: {},
...@@ -524,7 +524,7 @@ describe('Base editor', () => { ...@@ -524,7 +524,7 @@ describe('Base editor', () => {
}); });
it('sets default syntax highlighting theme', () => { it('sets default syntax highlighting theme', () => {
const expectedTheme = themes.find(t => t.name === DEFAULT_THEME); const expectedTheme = themes.find((t) => t.name === DEFAULT_THEME);
editor = new Editor(); editor = new Editor();
...@@ -533,7 +533,7 @@ describe('Base editor', () => { ...@@ -533,7 +533,7 @@ describe('Base editor', () => {
}); });
it('sets correct theme if it is set in users preferences', () => { it('sets correct theme if it is set in users preferences', () => {
const expectedTheme = themes.find(t => t.name !== DEFAULT_THEME); const expectedTheme = themes.find((t) => t.name !== DEFAULT_THEME);
expect(expectedTheme.name).not.toBe(DEFAULT_THEME); expect(expectedTheme.name).not.toBe(DEFAULT_THEME);
......
...@@ -114,7 +114,7 @@ describe('Markdown Extension for Editor Lite', () => { ...@@ -114,7 +114,7 @@ describe('Markdown Extension for Editor Lite', () => {
}); });
describe('moveCursor', () => { describe('moveCursor', () => {
const setPosition = endCol => { const setPosition = (endCol) => {
const currentPos = new Position(2, endCol); const currentPos = new Position(2, endCol);
instance.setPosition(currentPos); instance.setPosition(currentPos);
}; };
......
...@@ -369,11 +369,11 @@ describe('gl_emoji', () => { ...@@ -369,11 +369,11 @@ describe('gl_emoji', () => {
describe('searchEmoji', () => { describe('searchEmoji', () => {
const { atom, grey_question } = emojiFixtureMap; const { atom, grey_question } = emojiFixtureMap;
const search = (query, opts) => searchEmoji(query, opts).map(({ name }) => name); const search = (query, opts) => searchEmoji(query, opts).map(({ name }) => name);
const mangle = str => str.slice(0, 1) + str.slice(-1); const mangle = (str) => str.slice(0, 1) + str.slice(-1);
const partial = str => str.slice(0, 2); const partial = (str) => str.slice(0, 2);
describe('with default options', () => { describe('with default options', () => {
const subject = query => search(query); const subject = (query) => search(query);
describeEmojiFields('with $field', ({ accessor }) => { describeEmojiFields('with $field', ({ accessor }) => {
it(`should match by lower case: ${accessor(atom)}`, () => { it(`should match by lower case: ${accessor(atom)}`, () => {
...@@ -403,7 +403,7 @@ describe('gl_emoji', () => { ...@@ -403,7 +403,7 @@ describe('gl_emoji', () => {
}); });
describe('with fuzzy match', () => { describe('with fuzzy match', () => {
const subject = query => search(query, { match: 'fuzzy' }); const subject = (query) => search(query, { match: 'fuzzy' });
describeEmojiFields('with $field', ({ accessor }) => { describeEmojiFields('with $field', ({ accessor }) => {
it(`should match by lower case: ${accessor(atom)}`, () => { it(`should match by lower case: ${accessor(atom)}`, () => {
...@@ -421,7 +421,7 @@ describe('gl_emoji', () => { ...@@ -421,7 +421,7 @@ describe('gl_emoji', () => {
}); });
describe('with contains match', () => { describe('with contains match', () => {
const subject = query => search(query, { match: 'contains' }); const subject = (query) => search(query, { match: 'contains' });
describeEmojiFields('with $field', ({ accessor }) => { describeEmojiFields('with $field', ({ accessor }) => {
it(`should match by lower case: ${accessor(atom)}`, () => { it(`should match by lower case: ${accessor(atom)}`, () => {
...@@ -443,7 +443,7 @@ describe('gl_emoji', () => { ...@@ -443,7 +443,7 @@ describe('gl_emoji', () => {
}); });
describe('with fallback', () => { describe('with fallback', () => {
const subject = query => search(query, { fallback: true }); const subject = (query) => search(query, { fallback: true });
it.each` it.each`
query query
...@@ -454,7 +454,7 @@ describe('gl_emoji', () => { ...@@ -454,7 +454,7 @@ describe('gl_emoji', () => {
}); });
describe('with name and alias fields', () => { describe('with name and alias fields', () => {
const subject = query => search(query, { fields: ['name', 'alias'] }); const subject = (query) => search(query, { fields: ['name', 'alias'] });
it(`should match by name: ${atom.name}`, () => { it(`should match by name: ${atom.name}`, () => {
expect(subject(atom.name)).toContain(atom.name); expect(subject(atom.name)).toContain(atom.name);
......
...@@ -37,7 +37,7 @@ class CustomEnvironment extends JSDOMEnvironment { ...@@ -37,7 +37,7 @@ class CustomEnvironment extends JSDOMEnvironment {
this.rejectedPromises = []; this.rejectedPromises = [];
this.global.promiseRejectionHandler = error => { this.global.promiseRejectionHandler = (error) => {
this.rejectedPromises.push(error); this.rejectedPromises.push(error);
}; };
......
...@@ -38,9 +38,9 @@ describe('EnvironmentActions Component', () => { ...@@ -38,9 +38,9 @@ describe('EnvironmentActions Component', () => {
return createComponent({ actions: [scheduledJobAction, expiredJobAction] }, opts); return createComponent({ actions: [scheduledJobAction, expiredJobAction] }, opts);
} }
const findDropdownItem = action => { const findDropdownItem = (action) => {
const buttons = wrapper.findAll(GlDropdownItem); const buttons = wrapper.findAll(GlDropdownItem);
return buttons.filter(button => button.text().startsWith(action.name)).at(0); return buttons.filter((button) => button.text().startsWith(action.name)).at(0);
}; };
afterEach(() => { afterEach(() => {
......
...@@ -266,7 +266,7 @@ describe('Environment table', () => { ...@@ -266,7 +266,7 @@ describe('Environment table', () => {
}, },
}); });
expect(wrapper.vm.sortedEnvironments.map(env => env.name)).toEqual([ expect(wrapper.vm.sortedEnvironments.map((env) => env.name)).toEqual([
review.name, review.name,
staging.name, staging.name,
production.name, production.name,
......
...@@ -5,7 +5,7 @@ describe('Stop Component', () => { ...@@ -5,7 +5,7 @@ describe('Stop Component', () => {
let wrapper; let wrapper;
const terminalPath = '/path'; const terminalPath = '/path';
const mountWithProps = props => { const mountWithProps = (props) => {
wrapper = shallowMount(TerminalComponent, { wrapper = shallowMount(TerminalComponent, {
propsData: props, propsData: props,
}); });
......
...@@ -23,7 +23,7 @@ describe('Environments Folder View', () => { ...@@ -23,7 +23,7 @@ describe('Environments Folder View', () => {
helpCanaryDeploymentsPath: 'help/canary-deployments', helpCanaryDeploymentsPath: 'help/canary-deployments',
}; };
const mockEnvironments = environmentList => { const mockEnvironments = (environmentList) => {
mock.onGet(mockData.endpoint).reply( mock.onGet(mockData.endpoint).reply(
200, 200,
{ {
......
...@@ -38,8 +38,8 @@ describe('ErrorDetails', () => { ...@@ -38,8 +38,8 @@ describe('ErrorDetails', () => {
let mocks; let mocks;
const externalUrl = 'https://sentry.io/organizations/test-sentry-nk/issues/1/?project=1'; const externalUrl = 'https://sentry.io/organizations/test-sentry-nk/issues/1/?project=1';
const findInput = name => { const findInput = (name) => {
const inputs = wrapper.findAll(GlFormInput).filter(c => c.attributes('name') === name); const inputs = wrapper.findAll(GlFormInput).filter((c) => c.attributes('name') === name);
return inputs.length ? inputs.at(0) : inputs; return inputs.length ? inputs.at(0) : inputs;
}; };
...@@ -245,7 +245,7 @@ describe('ErrorDetails', () => { ...@@ -245,7 +245,7 @@ describe('ErrorDetails', () => {
it.each(Object.keys(severityLevel))( it.each(Object.keys(severityLevel))(
'should set correct severity level variant for %s badge', 'should set correct severity level variant for %s badge',
level => { (level) => {
wrapper.setData({ wrapper.setData({
error: { error: {
tags: { level: severityLevel[level] }, tags: { level: severityLevel[level] },
......
...@@ -147,7 +147,7 @@ describe('ErrorTrackingList', () => { ...@@ -147,7 +147,7 @@ describe('ErrorTrackingList', () => {
}); });
it('each error in the list should have an action button set', () => { it('each error in the list should have an action button set', () => {
findErrorListRows().wrappers.forEach(row => { findErrorListRows().wrappers.forEach((row) => {
expect(row.find(ErrorTrackingActions).exists()).toBe(true); expect(row.find(ErrorTrackingActions).exists()).toBe(true);
}); });
}); });
......
...@@ -28,7 +28,7 @@ describe('Sentry common store actions', () => { ...@@ -28,7 +28,7 @@ describe('Sentry common store actions', () => {
const params = { endpoint, redirectUrl, status }; const params = { endpoint, redirectUrl, status };
describe('updateStatus', () => { describe('updateStatus', () => {
it('should handle successful status update', done => { it('should handle successful status update', (done) => {
mock.onPut().reply(200, {}); mock.onPut().reply(200, {});
testAction( testAction(
actions.updateStatus, actions.updateStatus,
...@@ -48,7 +48,7 @@ describe('Sentry common store actions', () => { ...@@ -48,7 +48,7 @@ describe('Sentry common store actions', () => {
); );
}); });
it('should handle unsuccessful status update', done => { it('should handle unsuccessful status update', (done) => {
mock.onPut().reply(400, {}); mock.onPut().reply(400, {});
testAction(actions.updateStatus, params, {}, [], [], () => { testAction(actions.updateStatus, params, {}, [], [], () => {
expect(visitUrl).not.toHaveBeenCalled(); expect(visitUrl).not.toHaveBeenCalled();
......
...@@ -28,7 +28,7 @@ describe('Sentry error details store actions', () => { ...@@ -28,7 +28,7 @@ describe('Sentry error details store actions', () => {
describe('startPollingStacktrace', () => { describe('startPollingStacktrace', () => {
const endpoint = '123/stacktrace'; const endpoint = '123/stacktrace';
it('should commit SET_ERROR with received response', done => { it('should commit SET_ERROR with received response', (done) => {
const payload = { error: [1, 2, 3] }; const payload = { error: [1, 2, 3] };
mockedAdapter.onGet().reply(200, payload); mockedAdapter.onGet().reply(200, payload);
testAction( testAction(
...@@ -46,7 +46,7 @@ describe('Sentry error details store actions', () => { ...@@ -46,7 +46,7 @@ describe('Sentry error details store actions', () => {
); );
}); });
it('should show flash on API error', done => { it('should show flash on API error', (done) => {
mockedAdapter.onGet().reply(400); mockedAdapter.onGet().reply(400);
testAction( testAction(
...@@ -62,7 +62,7 @@ describe('Sentry error details store actions', () => { ...@@ -62,7 +62,7 @@ describe('Sentry error details store actions', () => {
); );
}); });
it('should not restart polling when receiving an empty 204 response', done => { it('should not restart polling when receiving an empty 204 response', (done) => {
mockedRestart = jest.spyOn(Poll.prototype, 'restart'); mockedRestart = jest.spyOn(Poll.prototype, 'restart');
mockedAdapter.onGet().reply(204); mockedAdapter.onGet().reply(204);
......
...@@ -20,7 +20,7 @@ describe('error tracking actions', () => { ...@@ -20,7 +20,7 @@ describe('error tracking actions', () => {
}); });
describe('startPolling', () => { describe('startPolling', () => {
it('should start polling for data', done => { it('should start polling for data', (done) => {
const payload = { errors: [{ id: 1 }, { id: 2 }] }; const payload = { errors: [{ id: 1 }, { id: 2 }] };
mock.onGet().reply(httpStatusCodes.OK, payload); mock.onGet().reply(httpStatusCodes.OK, payload);
...@@ -41,7 +41,7 @@ describe('error tracking actions', () => { ...@@ -41,7 +41,7 @@ describe('error tracking actions', () => {
); );
}); });
it('should show flash on API error', done => { it('should show flash on API error', (done) => {
mock.onGet().reply(httpStatusCodes.BAD_REQUEST); mock.onGet().reply(httpStatusCodes.BAD_REQUEST);
testAction( testAction(
......
...@@ -27,7 +27,7 @@ describe('error tracking settings actions', () => { ...@@ -27,7 +27,7 @@ describe('error tracking settings actions', () => {
refreshCurrentPage.mockClear(); refreshCurrentPage.mockClear();
}); });
it('should request and transform the project list', done => { it('should request and transform the project list', (done) => {
mock.onGet(TEST_HOST).reply(() => [200, { projects: projectList }]); mock.onGet(TEST_HOST).reply(() => [200, { projects: projectList }]);
testAction( testAction(
actions.fetchProjects, actions.fetchProjects,
...@@ -48,7 +48,7 @@ describe('error tracking settings actions', () => { ...@@ -48,7 +48,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should handle a server error', done => { it('should handle a server error', (done) => {
mock.onGet(`${TEST_HOST}.json`).reply(() => [400]); mock.onGet(`${TEST_HOST}.json`).reply(() => [400]);
testAction( testAction(
actions.fetchProjects, actions.fetchProjects,
...@@ -68,7 +68,7 @@ describe('error tracking settings actions', () => { ...@@ -68,7 +68,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should request projects correctly', done => { it('should request projects correctly', (done) => {
testAction( testAction(
actions.requestProjects, actions.requestProjects,
null, null,
...@@ -79,7 +79,7 @@ describe('error tracking settings actions', () => { ...@@ -79,7 +79,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should receive projects correctly', done => { it('should receive projects correctly', (done) => {
const testPayload = []; const testPayload = [];
testAction( testAction(
actions.receiveProjectsSuccess, actions.receiveProjectsSuccess,
...@@ -95,7 +95,7 @@ describe('error tracking settings actions', () => { ...@@ -95,7 +95,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should handle errors when receiving projects', done => { it('should handle errors when receiving projects', (done) => {
const testPayload = []; const testPayload = [];
testAction( testAction(
actions.receiveProjectsError, actions.receiveProjectsError,
...@@ -126,7 +126,7 @@ describe('error tracking settings actions', () => { ...@@ -126,7 +126,7 @@ describe('error tracking settings actions', () => {
mock.restore(); mock.restore();
}); });
it('should save the page', done => { it('should save the page', (done) => {
mock.onPatch(TEST_HOST).reply(200); mock.onPatch(TEST_HOST).reply(200);
testAction(actions.updateSettings, null, state, [], [{ type: 'requestSettings' }], () => { testAction(actions.updateSettings, null, state, [], [{ type: 'requestSettings' }], () => {
expect(mock.history.patch.length).toBe(1); expect(mock.history.patch.length).toBe(1);
...@@ -135,7 +135,7 @@ describe('error tracking settings actions', () => { ...@@ -135,7 +135,7 @@ describe('error tracking settings actions', () => {
}); });
}); });
it('should handle a server error', done => { it('should handle a server error', (done) => {
mock.onPatch(TEST_HOST).reply(400); mock.onPatch(TEST_HOST).reply(400);
testAction( testAction(
actions.updateSettings, actions.updateSettings,
...@@ -156,7 +156,7 @@ describe('error tracking settings actions', () => { ...@@ -156,7 +156,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should request to save the page', done => { it('should request to save the page', (done) => {
testAction( testAction(
actions.requestSettings, actions.requestSettings,
null, null,
...@@ -167,7 +167,7 @@ describe('error tracking settings actions', () => { ...@@ -167,7 +167,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should handle errors when requesting to save the page', done => { it('should handle errors when requesting to save the page', (done) => {
testAction( testAction(
actions.receiveSettingsError, actions.receiveSettingsError,
{}, {},
...@@ -181,7 +181,7 @@ describe('error tracking settings actions', () => { ...@@ -181,7 +181,7 @@ describe('error tracking settings actions', () => {
describe('generic actions to update the store', () => { describe('generic actions to update the store', () => {
const testData = 'test'; const testData = 'test';
it('should reset the `connect success` flag when updating the api host', done => { it('should reset the `connect success` flag when updating the api host', (done) => {
testAction( testAction(
actions.updateApiHost, actions.updateApiHost,
testData, testData,
...@@ -192,7 +192,7 @@ describe('error tracking settings actions', () => { ...@@ -192,7 +192,7 @@ describe('error tracking settings actions', () => {
); );
}); });
it('should reset the `connect success` flag when updating the token', done => { it('should reset the `connect success` flag when updating the token', (done) => {
testAction( testAction(
actions.updateToken, actions.updateToken,
testData, testData,
......
...@@ -36,7 +36,7 @@ describe('Configure Feature Flags Modal', () => { ...@@ -36,7 +36,7 @@ describe('Configure Feature Flags Modal', () => {
const findPrimaryAction = () => findGlModal().props('actionPrimary'); const findPrimaryAction = () => findGlModal().props('actionPrimary');
const findProjectNameInput = () => wrapper.find('#project_name_verification'); const findProjectNameInput = () => wrapper.find('#project_name_verification');
const findDangerGlAlert = () => const findDangerGlAlert = () =>
wrapper.findAll(GlAlert).filter(c => c.props('variant') === 'danger'); wrapper.findAll(GlAlert).filter((c) => c.props('variant') === 'danger');
describe('idle', () => { describe('idle', () => {
afterEach(() => wrapper.destroy()); afterEach(() => wrapper.destroy());
......
...@@ -42,7 +42,7 @@ describe('Edit feature flag form', () => { ...@@ -42,7 +42,7 @@ describe('Edit feature flag form', () => {
}); });
}; };
beforeEach(done => { beforeEach((done) => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
mock.onGet(`${TEST_HOST}/feature_flags.json`).replyOnce(200, { mock.onGet(`${TEST_HOST}/feature_flags.json`).replyOnce(200, {
id: 21, id: 21,
......
...@@ -11,7 +11,7 @@ describe('Feature flags > Environments dropdown ', () => { ...@@ -11,7 +11,7 @@ describe('Feature flags > Environments dropdown ', () => {
let wrapper; let wrapper;
let mock; let mock;
const results = ['production', 'staging']; const results = ['production', 'staging'];
const factory = props => { const factory = (props) => {
wrapper = shallowMount(EnvironmentsDropdown, { wrapper = shallowMount(EnvironmentsDropdown, {
propsData: { propsData: {
...props, ...props,
...@@ -100,7 +100,7 @@ describe('Feature flags > Environments dropdown ', () => { ...@@ -100,7 +100,7 @@ describe('Feature flags > Environments dropdown ', () => {
it('emits event when a suggestion is clicked', async () => { it('emits event when a suggestion is clicked', async () => {
const button = wrapper const button = wrapper
.findAll(GlButton) .findAll(GlButton)
.filter(b => b.text() === 'production') .filter((b) => b.text() === 'production')
.at(0); .at(0);
button.vm.$emit('click'); button.vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
......
...@@ -85,7 +85,7 @@ describe('Feature flags', () => { ...@@ -85,7 +85,7 @@ describe('Feature flags', () => {
describe('when limit exceeded', () => { describe('when limit exceeded', () => {
const provideData = { ...mockData, featureFlagsLimitExceeded: true }; const provideData = { ...mockData, featureFlagsLimitExceeded: true };
beforeEach(done => { beforeEach((done) => {
mock mock
.onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } })
.reply(200, getRequestData, {}); .reply(200, getRequestData, {});
...@@ -132,7 +132,7 @@ describe('Feature flags', () => { ...@@ -132,7 +132,7 @@ describe('Feature flags', () => {
newUserListPath: null, newUserListPath: null,
}; };
beforeEach(done => { beforeEach((done) => {
mock mock
.onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } })
.reply(200, getRequestData, {}); .reply(200, getRequestData, {});
...@@ -217,7 +217,7 @@ describe('Feature flags', () => { ...@@ -217,7 +217,7 @@ describe('Feature flags', () => {
}); });
describe('with paginated feature flags', () => { describe('with paginated feature flags', () => {
beforeEach(done => { beforeEach((done) => {
mock mock
.onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } })
.replyOnce(200, getRequestData, { .replyOnce(200, getRequestData, {
...@@ -297,7 +297,7 @@ describe('Feature flags', () => { ...@@ -297,7 +297,7 @@ describe('Feature flags', () => {
}); });
describe('in user lists tab', () => { describe('in user lists tab', () => {
beforeEach(done => { beforeEach((done) => {
factory(); factory();
setImmediate(done); setImmediate(done);
}); });
...@@ -317,7 +317,7 @@ describe('Feature flags', () => { ...@@ -317,7 +317,7 @@ describe('Feature flags', () => {
}); });
describe('unsuccessful request', () => { describe('unsuccessful request', () => {
beforeEach(done => { beforeEach((done) => {
mock mock
.onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .onGet(mockState.endpoint, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } })
.replyOnce(500, {}); .replyOnce(500, {});
...@@ -350,7 +350,7 @@ describe('Feature flags', () => { ...@@ -350,7 +350,7 @@ describe('Feature flags', () => {
}); });
describe('rotate instance id', () => { describe('rotate instance id', () => {
beforeEach(done => { beforeEach((done) => {
mock mock
.onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } }) .onGet(`${TEST_HOST}/endpoint.json`, { params: { scope: FEATURE_FLAG_SCOPE, page: '1' } })
.reply(200, getRequestData, {}); .reply(200, getRequestData, {});
......
...@@ -118,7 +118,7 @@ describe('feature flag form', () => { ...@@ -118,7 +118,7 @@ describe('feature flag form', () => {
}); });
}); });
it('should be disabled if the feature flag is not active', done => { it('should be disabled if the feature flag is not active', (done) => {
wrapper.setProps({ active: false }); wrapper.setProps({ active: false });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.find(ToggleButton).props('disabledInput')).toBe(true); expect(wrapper.find(ToggleButton).props('disabledInput')).toBe(true);
...@@ -191,7 +191,7 @@ describe('feature flag form', () => { ...@@ -191,7 +191,7 @@ describe('feature flag form', () => {
expect(wrapper.vm.formScopes[0].active).toBe(false); expect(wrapper.vm.formScopes[0].active).toBe(false);
}); });
it('should be disabled if the feature flag is not active', done => { it('should be disabled if the feature flag is not active', (done) => {
wrapper.setProps({ active: false }); wrapper.setProps({ active: false });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
...@@ -301,7 +301,7 @@ describe('feature flag form', () => { ...@@ -301,7 +301,7 @@ describe('feature flag form', () => {
}); });
describe('on submit', () => { describe('on submit', () => {
const selectFirstRolloutStrategyOption = dropdownIndex => { const selectFirstRolloutStrategyOption = (dropdownIndex) => {
wrapper wrapper
.findAll('select.js-rollout-strategy') .findAll('select.js-rollout-strategy')
.at(dropdownIndex) .at(dropdownIndex)
......
...@@ -94,7 +94,7 @@ describe('New Environments Dropdown', () => { ...@@ -94,7 +94,7 @@ describe('New Environments Dropdown', () => {
}); });
it('should not display a create label', () => { it('should not display a create label', () => {
items = items.filter(i => i.text().startsWith('Create')); items = items.filter((i) => i.text().startsWith('Create'));
expect(items).toHaveLength(0); expect(items).toHaveLength(0);
}); });
......
...@@ -66,7 +66,7 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => { ...@@ -66,7 +66,7 @@ describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => {
it('should search when the filter changes', async () => { it('should search when the filter changes', async () => {
let r; let r;
Api.searchFeatureFlagUserLists.mockReturnValue( Api.searchFeatureFlagUserLists.mockReturnValue(
new Promise(resolve => { new Promise((resolve) => {
r = resolve; r = resolve;
}), }),
); );
......
...@@ -42,7 +42,7 @@ describe('User Lists Table', () => { ...@@ -42,7 +42,7 @@ describe('User Lists Table', () => {
it('should display a user list entry per user list', () => { it('should display a user list entry per user list', () => {
const lists = wrapper.findAll('[data-testid="ffUserList"]'); const lists = wrapper.findAll('[data-testid="ffUserList"]');
expect(lists).toHaveLength(5); expect(lists).toHaveLength(5);
lists.wrappers.forEach(list => { lists.wrappers.forEach((list) => {
expect(list.find('[data-testid="ffUserListName"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListName"]').exists()).toBe(true);
expect(list.find('[data-testid="ffUserListIds"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListIds"]').exists()).toBe(true);
expect(list.find('[data-testid="ffUserListTimestamp"]').exists()).toBe(true); expect(list.find('[data-testid="ffUserListTimestamp"]').exists()).toBe(true);
......
...@@ -44,7 +44,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -44,7 +44,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', done => { it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagSuccess ', (done) => {
const featureFlag = { const featureFlag = {
name: 'feature_flag', name: 'feature_flag',
description: 'feature flag', description: 'feature flag',
...@@ -80,7 +80,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -80,7 +80,7 @@ describe('Feature flags Edit Module actions', () => {
done, done,
); );
}); });
it('handles new version flags as well', done => { it('handles new version flags as well', (done) => {
const featureFlag = { const featureFlag = {
name: 'name', name: 'name',
description: 'description', description: 'description',
...@@ -117,7 +117,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -117,7 +117,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', done => { it('dispatches requestUpdateFeatureFlag and receiveUpdateFeatureFlagError ', (done) => {
mock.onPut(`${TEST_HOST}/endpoint.json`).replyOnce(500, { message: [] }); mock.onPut(`${TEST_HOST}/endpoint.json`).replyOnce(500, { message: [] });
testAction( testAction(
...@@ -145,7 +145,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -145,7 +145,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('requestUpdateFeatureFlag', () => { describe('requestUpdateFeatureFlag', () => {
it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', done => { it('should commit REQUEST_UPDATE_FEATURE_FLAG mutation', (done) => {
testAction( testAction(
requestUpdateFeatureFlag, requestUpdateFeatureFlag,
null, null,
...@@ -158,7 +158,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -158,7 +158,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('receiveUpdateFeatureFlagSuccess', () => { describe('receiveUpdateFeatureFlagSuccess', () => {
it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', done => { it('should commit RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS mutation', (done) => {
testAction( testAction(
receiveUpdateFeatureFlagSuccess, receiveUpdateFeatureFlagSuccess,
null, null,
...@@ -175,7 +175,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -175,7 +175,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('receiveUpdateFeatureFlagError', () => { describe('receiveUpdateFeatureFlagError', () => {
it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', done => { it('should commit RECEIVE_UPDATE_FEATURE_FLAG_ERROR mutation', (done) => {
testAction( testAction(
receiveUpdateFeatureFlagError, receiveUpdateFeatureFlagError,
'There was an error', 'There was an error',
...@@ -200,7 +200,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -200,7 +200,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', done => { it('dispatches requestFeatureFlag and receiveFeatureFlagSuccess ', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 1 }); mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, { id: 1 });
testAction( testAction(
...@@ -223,7 +223,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -223,7 +223,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', done => { it('dispatches requestFeatureFlag and receiveUpdateFeatureFlagError ', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {});
testAction( testAction(
...@@ -246,7 +246,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -246,7 +246,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('requestFeatureFlag', () => { describe('requestFeatureFlag', () => {
it('should commit REQUEST_FEATURE_FLAG mutation', done => { it('should commit REQUEST_FEATURE_FLAG mutation', (done) => {
testAction( testAction(
requestFeatureFlag, requestFeatureFlag,
null, null,
...@@ -259,7 +259,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -259,7 +259,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('receiveFeatureFlagSuccess', () => { describe('receiveFeatureFlagSuccess', () => {
it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', done => { it('should commit RECEIVE_FEATURE_FLAG_SUCCESS mutation', (done) => {
testAction( testAction(
receiveFeatureFlagSuccess, receiveFeatureFlagSuccess,
{ id: 1 }, { id: 1 },
...@@ -272,7 +272,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -272,7 +272,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('receiveFeatureFlagError', () => { describe('receiveFeatureFlagError', () => {
it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', done => { it('should commit RECEIVE_FEATURE_FLAG_ERROR mutation', (done) => {
testAction( testAction(
receiveFeatureFlagError, receiveFeatureFlagError,
null, null,
...@@ -289,7 +289,7 @@ describe('Feature flags Edit Module actions', () => { ...@@ -289,7 +289,7 @@ describe('Feature flags Edit Module actions', () => {
}); });
describe('toggelActive', () => { describe('toggelActive', () => {
it('should commit TOGGLE_ACTIVE mutation', done => { it('should commit TOGGLE_ACTIVE mutation', (done) => {
testAction( testAction(
toggleActive, toggleActive,
true, true,
......
...@@ -40,7 +40,7 @@ describe('Feature flags actions', () => { ...@@ -40,7 +40,7 @@ describe('Feature flags actions', () => {
}); });
describe('setFeatureFlagsOptions', () => { describe('setFeatureFlagsOptions', () => {
it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', done => { it('should commit SET_FEATURE_FLAGS_OPTIONS mutation', (done) => {
testAction( testAction(
setFeatureFlagsOptions, setFeatureFlagsOptions,
{ page: '1', scope: 'all' }, { page: '1', scope: 'all' },
...@@ -65,7 +65,7 @@ describe('Feature flags actions', () => { ...@@ -65,7 +65,7 @@ describe('Feature flags actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', done => { it('dispatches requestFeatureFlags and receiveFeatureFlagsSuccess ', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, getRequestData, {}); mock.onGet(`${TEST_HOST}/endpoint.json`).replyOnce(200, getRequestData, {});
testAction( testAction(
...@@ -88,7 +88,7 @@ describe('Feature flags actions', () => { ...@@ -88,7 +88,7 @@ describe('Feature flags actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', done => { it('dispatches requestFeatureFlags and receiveFeatureFlagsError ', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {});
testAction( testAction(
...@@ -111,7 +111,7 @@ describe('Feature flags actions', () => { ...@@ -111,7 +111,7 @@ describe('Feature flags actions', () => {
}); });
describe('requestFeatureFlags', () => { describe('requestFeatureFlags', () => {
it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', done => { it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => {
testAction( testAction(
requestFeatureFlags, requestFeatureFlags,
null, null,
...@@ -124,7 +124,7 @@ describe('Feature flags actions', () => { ...@@ -124,7 +124,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveFeatureFlagsSuccess', () => { describe('receiveFeatureFlagsSuccess', () => {
it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', done => { it('should commit RECEIVE_FEATURE_FLAGS_SUCCESS mutation', (done) => {
testAction( testAction(
receiveFeatureFlagsSuccess, receiveFeatureFlagsSuccess,
{ data: getRequestData, headers: {} }, { data: getRequestData, headers: {} },
...@@ -142,7 +142,7 @@ describe('Feature flags actions', () => { ...@@ -142,7 +142,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveFeatureFlagsError', () => { describe('receiveFeatureFlagsError', () => {
it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', done => { it('should commit RECEIVE_FEATURE_FLAGS_ERROR mutation', (done) => {
testAction( testAction(
receiveFeatureFlagsError, receiveFeatureFlagsError,
null, null,
...@@ -160,7 +160,7 @@ describe('Feature flags actions', () => { ...@@ -160,7 +160,7 @@ describe('Feature flags actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestUserLists and receiveUserListsSuccess ', done => { it('dispatches requestUserLists and receiveUserListsSuccess ', (done) => {
testAction( testAction(
fetchUserLists, fetchUserLists,
null, null,
...@@ -181,7 +181,7 @@ describe('Feature flags actions', () => { ...@@ -181,7 +181,7 @@ describe('Feature flags actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('dispatches requestUserLists and receiveUserListsError ', done => { it('dispatches requestUserLists and receiveUserListsError ', (done) => {
Api.fetchFeatureFlagUserLists.mockRejectedValue(); Api.fetchFeatureFlagUserLists.mockRejectedValue();
testAction( testAction(
...@@ -204,7 +204,7 @@ describe('Feature flags actions', () => { ...@@ -204,7 +204,7 @@ describe('Feature flags actions', () => {
}); });
describe('requestUserLists', () => { describe('requestUserLists', () => {
it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', done => { it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => {
testAction( testAction(
requestUserLists, requestUserLists,
null, null,
...@@ -217,7 +217,7 @@ describe('Feature flags actions', () => { ...@@ -217,7 +217,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveUserListsSuccess', () => { describe('receiveUserListsSuccess', () => {
it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', done => { it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => {
testAction( testAction(
receiveUserListsSuccess, receiveUserListsSuccess,
{ data: [userList], headers: {} }, { data: [userList], headers: {} },
...@@ -235,7 +235,7 @@ describe('Feature flags actions', () => { ...@@ -235,7 +235,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveUserListsError', () => { describe('receiveUserListsError', () => {
it('should commit RECEIVE_USER_LISTS_ERROR mutation', done => { it('should commit RECEIVE_USER_LISTS_ERROR mutation', (done) => {
testAction( testAction(
receiveUserListsError, receiveUserListsError,
null, null,
...@@ -260,7 +260,7 @@ describe('Feature flags actions', () => { ...@@ -260,7 +260,7 @@ describe('Feature flags actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', done => { it('dispatches requestRotateInstanceId and receiveRotateInstanceIdSuccess ', (done) => {
mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(200, rotateData, {}); mock.onPost(`${TEST_HOST}/endpoint.json`).replyOnce(200, rotateData, {});
testAction( testAction(
...@@ -283,7 +283,7 @@ describe('Feature flags actions', () => { ...@@ -283,7 +283,7 @@ describe('Feature flags actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', done => { it('dispatches requestRotateInstanceId and receiveRotateInstanceIdError ', (done) => {
mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {}); mock.onGet(`${TEST_HOST}/endpoint.json`, {}).replyOnce(500, {});
testAction( testAction(
...@@ -306,7 +306,7 @@ describe('Feature flags actions', () => { ...@@ -306,7 +306,7 @@ describe('Feature flags actions', () => {
}); });
describe('requestRotateInstanceId', () => { describe('requestRotateInstanceId', () => {
it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', done => { it('should commit REQUEST_ROTATE_INSTANCE_ID mutation', (done) => {
testAction( testAction(
requestRotateInstanceId, requestRotateInstanceId,
null, null,
...@@ -319,7 +319,7 @@ describe('Feature flags actions', () => { ...@@ -319,7 +319,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveRotateInstanceIdSuccess', () => { describe('receiveRotateInstanceIdSuccess', () => {
it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', done => { it('should commit RECEIVE_ROTATE_INSTANCE_ID_SUCCESS mutation', (done) => {
testAction( testAction(
receiveRotateInstanceIdSuccess, receiveRotateInstanceIdSuccess,
{ data: rotateData, headers: {} }, { data: rotateData, headers: {} },
...@@ -337,7 +337,7 @@ describe('Feature flags actions', () => { ...@@ -337,7 +337,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveRotateInstanceIdError', () => { describe('receiveRotateInstanceIdError', () => {
it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', done => { it('should commit RECEIVE_ROTATE_INSTANCE_ID_ERROR mutation', (done) => {
testAction( testAction(
receiveRotateInstanceIdError, receiveRotateInstanceIdError,
null, null,
...@@ -353,7 +353,7 @@ describe('Feature flags actions', () => { ...@@ -353,7 +353,7 @@ describe('Feature flags actions', () => {
let mock; let mock;
beforeEach(() => { beforeEach(() => {
mockedState.featureFlags = getRequestData.feature_flags.map(flag => ({ mockedState.featureFlags = getRequestData.feature_flags.map((flag) => ({
...flag, ...flag,
scopes: mapToScopesViewModel(flag.scopes || []), scopes: mapToScopesViewModel(flag.scopes || []),
})); }));
...@@ -364,7 +364,7 @@ describe('Feature flags actions', () => { ...@@ -364,7 +364,7 @@ describe('Feature flags actions', () => {
mock.restore(); mock.restore();
}); });
describe('success', () => { describe('success', () => {
it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', done => { it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => {
mock.onPut(featureFlag.update_path).replyOnce(200, featureFlag, {}); mock.onPut(featureFlag.update_path).replyOnce(200, featureFlag, {});
testAction( testAction(
...@@ -387,7 +387,7 @@ describe('Feature flags actions', () => { ...@@ -387,7 +387,7 @@ describe('Feature flags actions', () => {
}); });
}); });
describe('error', () => { describe('error', () => {
it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', done => { it('dispatches updateFeatureFlag and receiveUpdateFeatureFlagSuccess', (done) => {
mock.onPut(featureFlag.update_path).replyOnce(500); mock.onPut(featureFlag.update_path).replyOnce(500);
testAction( testAction(
...@@ -412,13 +412,13 @@ describe('Feature flags actions', () => { ...@@ -412,13 +412,13 @@ describe('Feature flags actions', () => {
}); });
describe('updateFeatureFlag', () => { describe('updateFeatureFlag', () => {
beforeEach(() => { beforeEach(() => {
mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({
...f, ...f,
scopes: mapToScopesViewModel(f.scopes || []), scopes: mapToScopesViewModel(f.scopes || []),
})); }));
}); });
it('commits UPDATE_FEATURE_FLAG with the given flag', done => { it('commits UPDATE_FEATURE_FLAG with the given flag', (done) => {
testAction( testAction(
updateFeatureFlag, updateFeatureFlag,
featureFlag, featureFlag,
...@@ -436,13 +436,13 @@ describe('Feature flags actions', () => { ...@@ -436,13 +436,13 @@ describe('Feature flags actions', () => {
}); });
describe('receiveUpdateFeatureFlagSuccess', () => { describe('receiveUpdateFeatureFlagSuccess', () => {
beforeEach(() => { beforeEach(() => {
mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({
...f, ...f,
scopes: mapToScopesViewModel(f.scopes || []), scopes: mapToScopesViewModel(f.scopes || []),
})); }));
}); });
it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', done => { it('commits RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS with the given flag', (done) => {
testAction( testAction(
receiveUpdateFeatureFlagSuccess, receiveUpdateFeatureFlagSuccess,
featureFlag, featureFlag,
...@@ -460,13 +460,13 @@ describe('Feature flags actions', () => { ...@@ -460,13 +460,13 @@ describe('Feature flags actions', () => {
}); });
describe('receiveUpdateFeatureFlagError', () => { describe('receiveUpdateFeatureFlagError', () => {
beforeEach(() => { beforeEach(() => {
mockedState.featureFlags = getRequestData.feature_flags.map(f => ({ mockedState.featureFlags = getRequestData.feature_flags.map((f) => ({
...f, ...f,
scopes: mapToScopesViewModel(f.scopes || []), scopes: mapToScopesViewModel(f.scopes || []),
})); }));
}); });
it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', done => { it('commits RECEIVE_UPDATE_FEATURE_FLAG_ERROR with the given flag id', (done) => {
testAction( testAction(
receiveUpdateFeatureFlagError, receiveUpdateFeatureFlagError,
featureFlag.id, featureFlag.id,
...@@ -492,7 +492,7 @@ describe('Feature flags actions', () => { ...@@ -492,7 +492,7 @@ describe('Feature flags actions', () => {
Api.deleteFeatureFlagUserList.mockResolvedValue(); Api.deleteFeatureFlagUserList.mockResolvedValue();
}); });
it('should refresh the user lists', done => { it('should refresh the user lists', (done) => {
testAction( testAction(
deleteUserList, deleteUserList,
userList, userList,
...@@ -509,7 +509,7 @@ describe('Feature flags actions', () => { ...@@ -509,7 +509,7 @@ describe('Feature flags actions', () => {
Api.deleteFeatureFlagUserList.mockRejectedValue({ response: { data: 'some error' } }); Api.deleteFeatureFlagUserList.mockRejectedValue({ response: { data: 'some error' } });
}); });
it('should dispatch receiveDeleteUserListError', done => { it('should dispatch receiveDeleteUserListError', (done) => {
testAction( testAction(
deleteUserList, deleteUserList,
userList, userList,
...@@ -529,7 +529,7 @@ describe('Feature flags actions', () => { ...@@ -529,7 +529,7 @@ describe('Feature flags actions', () => {
}); });
describe('receiveDeleteUserListError', () => { describe('receiveDeleteUserListError', () => {
it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', done => { it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', (done) => {
testAction( testAction(
receiveDeleteUserListError, receiveDeleteUserListError,
{ list: userList, error: 'mock error' }, { list: userList, error: 'mock error' },
...@@ -547,7 +547,7 @@ describe('Feature flags actions', () => { ...@@ -547,7 +547,7 @@ describe('Feature flags actions', () => {
}); });
describe('clearAlert', () => { describe('clearAlert', () => {
it('should commit RECEIVE_CLEAR_ALERT', done => { it('should commit RECEIVE_CLEAR_ALERT', (done) => {
const alertIndex = 3; const alertIndex = 3;
testAction( testAction(
......
...@@ -50,7 +50,7 @@ describe('Feature flags store Mutations', () => { ...@@ -50,7 +50,7 @@ describe('Feature flags store Mutations', () => {
}); });
it('should set featureFlags with the transformed data', () => { it('should set featureFlags with the transformed data', () => {
const expected = getRequestData.feature_flags.map(flag => ({ const expected = getRequestData.feature_flags.map((flag) => ({
...flag, ...flag,
scopes: mapToScopesViewModel(flag.scopes || []), scopes: mapToScopesViewModel(flag.scopes || []),
})); }));
...@@ -183,7 +183,7 @@ describe('Feature flags store Mutations', () => { ...@@ -183,7 +183,7 @@ describe('Feature flags store Mutations', () => {
describe('UPDATE_FEATURE_FLAG', () => { describe('UPDATE_FEATURE_FLAG', () => {
beforeEach(() => { beforeEach(() => {
stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({
...flag, ...flag,
scopes: mapToScopesViewModel(flag.scopes || []), scopes: mapToScopesViewModel(flag.scopes || []),
})); }));
...@@ -209,7 +209,7 @@ describe('Feature flags store Mutations', () => { ...@@ -209,7 +209,7 @@ describe('Feature flags store Mutations', () => {
describe('RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS', () => { describe('RECEIVE_UPDATE_FEATURE_FLAG_SUCCESS', () => {
const runUpdate = (stateCount, flagState, featureFlagUpdateParams) => { const runUpdate = (stateCount, flagState, featureFlagUpdateParams) => {
stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({
...flag, ...flag,
...flagState, ...flagState,
scopes: mapToScopesViewModel(flag.scopes || []), scopes: mapToScopesViewModel(flag.scopes || []),
...@@ -237,7 +237,7 @@ describe('Feature flags store Mutations', () => { ...@@ -237,7 +237,7 @@ describe('Feature flags store Mutations', () => {
describe('RECEIVE_UPDATE_FEATURE_FLAG_ERROR', () => { describe('RECEIVE_UPDATE_FEATURE_FLAG_ERROR', () => {
beforeEach(() => { beforeEach(() => {
stateCopy.featureFlags = getRequestData.feature_flags.map(flag => ({ stateCopy.featureFlags = getRequestData.feature_flags.map((flag) => ({
...flag, ...flag,
scopes: mapToScopesViewModel(flag.scopes || []), scopes: mapToScopesViewModel(flag.scopes || []),
})); }));
......
...@@ -59,7 +59,7 @@ describe('Feature flags New Module Actions', () => { ...@@ -59,7 +59,7 @@ describe('Feature flags New Module Actions', () => {
}); });
describe('success', () => { describe('success', () => {
it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagSuccess ', done => { it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagSuccess ', (done) => {
const convertedActionParams = mapFromScopesViewModel(actionParams); const convertedActionParams = mapFromScopesViewModel(actionParams);
mock.onPost(`${TEST_HOST}/endpoint.json`, convertedActionParams).replyOnce(200); mock.onPost(`${TEST_HOST}/endpoint.json`, convertedActionParams).replyOnce(200);
...@@ -81,7 +81,7 @@ describe('Feature flags New Module Actions', () => { ...@@ -81,7 +81,7 @@ describe('Feature flags New Module Actions', () => {
); );
}); });
it('sends strategies for new style feature flags', done => { it('sends strategies for new style feature flags', (done) => {
const newVersionFlagParams = { const newVersionFlagParams = {
name: 'name', name: 'name',
description: 'description', description: 'description',
...@@ -120,7 +120,7 @@ describe('Feature flags New Module Actions', () => { ...@@ -120,7 +120,7 @@ describe('Feature flags New Module Actions', () => {
}); });
describe('error', () => { describe('error', () => {
it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagError ', done => { it('dispatches requestCreateFeatureFlag and receiveCreateFeatureFlagError ', (done) => {
const convertedActionParams = mapFromScopesViewModel(actionParams); const convertedActionParams = mapFromScopesViewModel(actionParams);
mock mock
...@@ -148,7 +148,7 @@ describe('Feature flags New Module Actions', () => { ...@@ -148,7 +148,7 @@ describe('Feature flags New Module Actions', () => {
}); });
describe('requestCreateFeatureFlag', () => { describe('requestCreateFeatureFlag', () => {
it('should commit REQUEST_CREATE_FEATURE_FLAG mutation', done => { it('should commit REQUEST_CREATE_FEATURE_FLAG mutation', (done) => {
testAction( testAction(
requestCreateFeatureFlag, requestCreateFeatureFlag,
null, null,
...@@ -161,7 +161,7 @@ describe('Feature flags New Module Actions', () => { ...@@ -161,7 +161,7 @@ describe('Feature flags New Module Actions', () => {
}); });
describe('receiveCreateFeatureFlagSuccess', () => { describe('receiveCreateFeatureFlagSuccess', () => {
it('should commit RECEIVE_CREATE_FEATURE_FLAG_SUCCESS mutation', done => { it('should commit RECEIVE_CREATE_FEATURE_FLAG_SUCCESS mutation', (done) => {
testAction( testAction(
receiveCreateFeatureFlagSuccess, receiveCreateFeatureFlagSuccess,
null, null,
...@@ -178,7 +178,7 @@ describe('Feature flags New Module Actions', () => { ...@@ -178,7 +178,7 @@ describe('Feature flags New Module Actions', () => {
}); });
describe('receiveCreateFeatureFlagError', () => { describe('receiveCreateFeatureFlagError', () => {
it('should commit RECEIVE_CREATE_FEATURE_FLAG_ERROR mutation', done => { it('should commit RECEIVE_CREATE_FEATURE_FLAG_ERROR mutation', (done) => {
testAction( testAction(
receiveCreateFeatureFlagError, receiveCreateFeatureFlagError,
'There was an error', 'There was an error',
......
...@@ -44,7 +44,7 @@ describe('feature highlight helper', () => { ...@@ -44,7 +44,7 @@ describe('feature highlight helper', () => {
}); });
describe('inserted', () => { describe('inserted', () => {
it('registers click event callback', done => { it('registers click event callback', (done) => {
const context = { const context = {
getAttribute: () => 'popoverId', getAttribute: () => 'popoverId',
dataset: { dataset: {
...@@ -52,7 +52,7 @@ describe('feature highlight helper', () => { ...@@ -52,7 +52,7 @@ describe('feature highlight helper', () => {
}, },
}; };
jest.spyOn($.fn, 'on').mockImplementation(event => { jest.spyOn($.fn, 'on').mockImplementation((event) => {
expect(event).toEqual('click'); expect(event).toEqual('click');
done(); done();
}); });
......
...@@ -10,7 +10,7 @@ describe('Recent Searches Dropdown Content', () => { ...@@ -10,7 +10,7 @@ describe('Recent Searches Dropdown Content', () => {
const findDropdownItems = () => wrapper.findAll({ ref: 'dropdownItem' }); const findDropdownItems = () => wrapper.findAll({ ref: 'dropdownItem' });
const findDropdownNote = () => wrapper.find({ ref: 'dropdownNote' }); const findDropdownNote = () => wrapper.find({ ref: 'dropdownNote' });
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(RecentSearchesDropdownContent, { wrapper = shallowMount(RecentSearchesDropdownContent, {
propsData: { propsData: {
allowedKeys: IssuableFilteredSearchTokenKeys.getKeys(), allowedKeys: IssuableFilteredSearchTokenKeys.getKeys(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment