Commit e3aca8c8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 33 files - 53 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 3b1593f2
......@@ -1531,41 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_spec.js
## relaxed-goldwasser
spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/lodash/debounce.js
spec/frontend/__mocks__/lodash/throttle.js
spec/frontend/activities_spec.js
spec/frontend/add_context_commits_modal/store/actions_spec.js
spec/frontend/admin/statistics_panel/components/app_spec.js
spec/frontend/admin/statistics_panel/store/actions_spec.js
spec/frontend/alert_handler_spec.js
spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
spec/frontend/analytics/instance_statistics/components/app_spec.js
spec/frontend/api_spec.js
spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js
spec/frontend/authentication/u2f/authenticate_spec.js
spec/frontend/authentication/u2f/register_spec.js
spec/frontend/awards_handler_spec.js
spec/frontend/badges/components/badge_form_spec.js
spec/frontend/badges/components/badge_list_row_spec.js
spec/frontend/badges/components/badge_list_spec.js
spec/frontend/badges/components/badge_spec.js
spec/frontend/badges/store/actions_spec.js
spec/frontend/batch_comments/components/draft_note_spec.js
spec/frontend/batch_comments/components/drafts_count_spec.js
spec/frontend/batch_comments/components/preview_item_spec.js
spec/frontend/batch_comments/components/publish_button_spec.js
spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
spec/frontend/behaviors/autosize_spec.js
spec/frontend/behaviors/copy_as_gfm_spec.js
spec/frontend/behaviors/load_startup_css_spec.js
spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js
## eager-lamport
spec/frontend/behaviors/shortcuts/keybindings_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
......
......@@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
required: false,
default: () => [],
},
...Object.fromEntries(['target', 'triggers', 'placement'].map(prop => [prop, {}])),
...Object.fromEntries(['target', 'triggers', 'placement'].map((prop) => [prop, {}])),
},
render(h) {
return h(
......@@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
class: 'gl-popover',
...this.$attrs,
},
Object.keys(this.$slots).map(s => this.$slots[s]),
Object.keys(this.$slots).map((s) => this.$slots[s]),
);
},
}));
......@@ -8,7 +8,7 @@
// [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378
// Further reference: https://github.com/facebook/jest/issues/3465
export default fn => {
export default (fn) => {
const debouncedFn = jest.fn().mockImplementation(fn);
debouncedFn.cancel = jest.fn();
debouncedFn.flush = jest.fn().mockImplementation(() => {
......
// Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs.
// See `./debounce.js` for more details.
export default fn => fn;
export default (fn) => fn;
......@@ -44,14 +44,14 @@ describe('Activities', () => {
});
for (let i = 0; i < filters.length; i += 1) {
(i => {
((i) => {
describe(`when selecting ${getEventName(i)}`, () => {
beforeEach(() => {
$(getSelector(i)).click();
});
for (let x = 0; x < filters.length; x += 1) {
(x => {
((x) => {
const shouldHighlight = i === x;
const testName = shouldHighlight ? 'should highlight' : 'should not highlight';
......
......@@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setBaseConfig', () => {
it('commits SET_BASE_CONFIG', done => {
it('commits SET_BASE_CONFIG', (done) => {
const options = { contextCommitsPath, mergeRequestIid, projectId };
testAction(
setBaseConfig,
......@@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setTabIndex', () => {
it('commits SET_TABINDEX', done => {
it('commits SET_TABINDEX', (done) => {
testAction(
setTabIndex,
{ tabIndex: 1 },
......@@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setCommits', () => {
it('commits SET_COMMITS', done => {
it('commits SET_COMMITS', (done) => {
testAction(
setCommits,
{ commits: [], silentAddition: false },
......@@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => {
);
});
it('commits SET_COMMITS_SILENT', done => {
it('commits SET_COMMITS_SILENT', (done) => {
testAction(
setCommits,
{ commits: [], silentAddition: true },
......@@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('createContextCommits', () => {
it('calls API to create context commits', done => {
it('calls API to create context commits', (done) => {
mock.onPost(contextCommitEndpoint).reply(200, {});
testAction(createContextCommits, { commits: [] }, {}, [], [], done);
......@@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => {
)
.reply(200, [dummyCommit]);
});
it('commits FETCH_CONTEXT_COMMITS', done => {
it('commits FETCH_CONTEXT_COMMITS', (done) => {
const contextCommit = { ...dummyCommit, isSelected: true };
testAction(
fetchContextCommits,
......@@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setContextCommits', () => {
it('commits SET_CONTEXT_COMMITS', done => {
it('commits SET_CONTEXT_COMMITS', (done) => {
testAction(
setContextCommits,
{ data: [] },
......@@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => {
.onDelete('/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits')
.reply(204);
});
it('calls API to remove context commits', done => {
it('calls API to remove context commits', (done) => {
testAction(
removeContextCommits,
{ forceReload: false },
......@@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setSelectedCommits', () => {
it('commits SET_SELECTED_COMMITS', done => {
it('commits SET_SELECTED_COMMITS', (done) => {
testAction(
setSelectedCommits,
[dummyCommit],
......@@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setSearchText', () => {
it('commits SET_SEARCH_TEXT', done => {
it('commits SET_SEARCH_TEXT', (done) => {
const searchText = 'Dummy Text';
testAction(
setSearchText,
......@@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setToRemoveCommits', () => {
it('commits SET_TO_REMOVE_COMMITS', done => {
it('commits SET_TO_REMOVE_COMMITS', (done) => {
const commitId = 'abcde';
testAction(
......@@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('resetModalState', () => {
it('commits RESET_MODAL_STATE', done => {
it('commits RESET_MODAL_STATE', (done) => {
const commitId = 'abcde';
testAction(
......
......@@ -34,7 +34,7 @@ describe('Admin statistics app', () => {
wrapper.destroy();
});
const findStats = idx => wrapper.findAll('.js-stats').at(idx);
const findStats = (idx) => wrapper.findAll('.js-stats').at(idx);
describe('template', () => {
describe('when app is loading', () => {
......
......@@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => {
mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(200, mockStatistics);
});
it('dispatches success with received data', done =>
it('dispatches success with received data', (done) =>
testAction(
actions.fetchStatistics,
null,
......@@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => {
mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(500);
});
it('dispatches error', done =>
it('dispatches error', (done) =>
testAction(
actions.fetchStatistics,
null,
......@@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => {
});
describe('requestStatistic', () => {
it('should commit the request mutation', done =>
it('should commit the request mutation', (done) =>
testAction(
actions.requestStatistics,
null,
......@@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => {
});
describe('receiveStatisticsSuccess', () => {
it('should commit received data', done =>
it('should commit received data', (done) =>
testAction(
actions.receiveStatisticsSuccess,
mockStatistics,
......@@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => {
});
describe('receiveStatisticsError', () => {
it('should commit error', done => {
it('should commit error', (done) => {
testAction(
actions.receiveStatisticsError,
500,
......
......@@ -7,7 +7,7 @@ describe('Alert Handler', () => {
const DISMISS_CLASS = 'gl-alert-dismiss';
const DISMISS_LABEL = 'Dismiss';
const generateHtml = parentClass =>
const generateHtml = (parentClass) =>
`<div class="${parentClass}">
<button aria-label="${DISMISS_LABEL}">Dismiss</button>
</div>`;
......
......@@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => {
const findUrl = () => wrapper.find('#url');
const findAuthorizationKey = () => wrapper.find('#authorization-key');
const findDescription = () => wrapper.find('[data-testid="description"');
const findActiveStatusIcon = val =>
const findActiveStatusIcon = (val) =>
document.querySelector(`.js-service-active-status[data-value=${val.toString()}]`);
beforeEach(() => {
......
......@@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => {
const dropdownItems = dropdown.findAll(GlDropdownItem);
const { nodes } = parsedMapping.samplePayload.payloadAlerFields;
const numberOfMappingOptions = nodes.filter(({ type }) =>
type.some(t => compatibleTypes.includes(t)),
type.some((t) => compatibleTypes.includes(t)),
);
expect(dropdown.exists()).toBe(true);
......@@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => {
const dropdownItems = dropdown.findAll(GlDropdownItem);
const { nodes } = parsedMapping.samplePayload.payloadAlerFields;
const numberOfMappingOptions = nodes.filter(({ type }) =>
type.some(t => compatibleTypes.includes(t)),
type.some((t) => compatibleTypes.includes(t)),
);
expect(searchBox.exists()).toBe(Boolean(numberOfFallbacks));
......
......@@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => {
// TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
describe('Opsgenie integration', () => {
it.each([true, false])('it shows/hides the alert when opsgenie is %s', active => {
it.each([true, false])('it shows/hides the alert when opsgenie is %s', (active) => {
createComponent({
data: { integrations: { list: mockIntegrations }, currentIntegration: mockIntegrations[0] },
provide: { opsgenie: { active } },
......
......@@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => {
expect(wrapper.find(InstanceCounts).exists()).toBe(true);
});
['Pipelines', 'Issues & Merge Requests'].forEach(instance => {
['Pipelines', 'Issues & Merge Requests'].forEach((instance) => {
it(`displays the ${instance} chart`, () => {
const chartTitles = wrapper
.findAll(InstanceStatisticsCountChart)
.wrappers.map(chartComponent => chartComponent.props('chartTitle'));
.wrappers.map((chartComponent) => chartComponent.props('chartTitle'));
expect(chartTitles).toContain(instance);
});
......
......@@ -34,7 +34,7 @@ describe('Api', () => {
expect(builtUrl).toEqual(expectedOutput);
});
[null, '', '/'].forEach(root => {
[null, '', '/'].forEach((root) => {
it(`works when relative_url_root is ${root}`, () => {
window.gon.relative_url_root = root;
const input = '/api/:version/foo/bar';
......@@ -137,14 +137,14 @@ describe('Api', () => {
});
describe('group', () => {
it('fetches a group', done => {
it('fetches a group', (done) => {
const groupId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}`;
mock.onGet(expectedUrl).reply(httpStatus.OK, {
name: 'test',
});
Api.group(groupId, response => {
Api.group(groupId, (response) => {
expect(response.name).toBe('test');
done();
});
......@@ -152,7 +152,7 @@ describe('Api', () => {
});
describe('groupMembers', () => {
it('fetches group members', done => {
it('fetches group members', (done) => {
const groupId = '54321';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/members`;
const expectedData = [{ id: 7 }];
......@@ -168,7 +168,7 @@ describe('Api', () => {
});
describe('groupMilestones', () => {
it('fetches group milestones', done => {
it('fetches group milestones', (done) => {
const groupId = '16';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/milestones`;
const expectedData = [
......@@ -198,7 +198,7 @@ describe('Api', () => {
});
describe('groups', () => {
it('fetches groups', done => {
it('fetches groups', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups.json`;
......@@ -208,7 +208,7 @@ describe('Api', () => {
},
]);
Api.groups(query, options, response => {
Api.groups(query, options, (response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
done();
......@@ -217,7 +217,7 @@ describe('Api', () => {
});
describe('namespaces', () => {
it('fetches namespaces', done => {
it('fetches namespaces', (done) => {
const query = 'dummy query';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/namespaces.json`;
mock.onGet(expectedUrl).reply(httpStatus.OK, [
......@@ -226,7 +226,7 @@ describe('Api', () => {
},
]);
Api.namespaces(query, response => {
Api.namespaces(query, (response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
done();
......@@ -235,7 +235,7 @@ describe('Api', () => {
});
describe('projects', () => {
it('fetches projects with membership when logged in', done => {
it('fetches projects with membership when logged in', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json`;
......@@ -246,14 +246,14 @@ describe('Api', () => {
},
]);
Api.projects(query, options, response => {
Api.projects(query, options, (response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
done();
});
});
it('fetches projects without membership when not logged in', done => {
it('fetches projects without membership when not logged in', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects.json`;
......@@ -263,7 +263,7 @@ describe('Api', () => {
},
]);
Api.projects(query, options, response => {
Api.projects(query, options, (response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
done();
......@@ -272,7 +272,7 @@ describe('Api', () => {
});
describe('updateProject', () => {
it('update a project with the given payload', done => {
it('update a project with the given payload', (done) => {
const projectPath = 'foo';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}`;
mock.onPut(expectedUrl).reply(httpStatus.OK, { foo: 'bar' });
......@@ -287,7 +287,7 @@ describe('Api', () => {
});
describe('projectUsers', () => {
it('fetches all users of a particular project', done => {
it('fetches all users of a particular project', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const projectPath = 'gitlab-org%2Fgitlab-ce';
......@@ -299,7 +299,7 @@ describe('Api', () => {
]);
Api.projectUsers('gitlab-org/gitlab-ce', query, options)
.then(response => {
.then((response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
})
......@@ -312,7 +312,7 @@ describe('Api', () => {
const projectPath = 'abc';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests`;
it('fetches all merge requests for a project', done => {
it('fetches all merge requests for a project', (done) => {
const mockData = [{ source_branch: 'foo' }, { source_branch: 'bar' }];
mock.onGet(expectedUrl).reply(httpStatus.OK, mockData);
Api.projectMergeRequests(projectPath)
......@@ -325,7 +325,7 @@ describe('Api', () => {
.catch(done.fail);
});
it('fetches merge requests filtered with passed params', done => {
it('fetches merge requests filtered with passed params', (done) => {
const params = {
source_branch: 'bar',
};
......@@ -343,7 +343,7 @@ describe('Api', () => {
});
describe('projectMergeRequest', () => {
it('fetches a merge request', done => {
it('fetches a merge request', (done) => {
const projectPath = 'abc';
const mergeRequestId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}`;
......@@ -361,7 +361,7 @@ describe('Api', () => {
});
describe('projectMergeRequestChanges', () => {
it('fetches the changes of a merge request', done => {
it('fetches the changes of a merge request', (done) => {
const projectPath = 'abc';
const mergeRequestId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}/changes`;
......@@ -379,7 +379,7 @@ describe('Api', () => {
});
describe('projectMergeRequestVersions', () => {
it('fetches the versions of a merge request', done => {
it('fetches the versions of a merge request', (done) => {
const projectPath = 'abc';
const mergeRequestId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}/versions`;
......@@ -400,7 +400,7 @@ describe('Api', () => {
});
describe('projectRunners', () => {
it('fetches the runners of a project', done => {
it('fetches the runners of a project', (done) => {
const projectPath = 7;
const params = { scope: 'active' };
const mockData = [{ id: 4 }];
......@@ -417,7 +417,7 @@ describe('Api', () => {
});
describe('projectMilestones', () => {
it('fetches project milestones', done => {
it('fetches project milestones', (done) => {
const projectId = 1;
const options = { state: 'active' };
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/1/milestones`;
......@@ -459,7 +459,7 @@ describe('Api', () => {
});
describe('newLabel', () => {
it('creates a new label', done => {
it('creates a new label', (done) => {
const namespace = 'some namespace';
const project = 'some project';
const labelData = { some: 'data' };
......@@ -467,7 +467,7 @@ describe('Api', () => {
const expectedData = {
label: labelData,
};
mock.onPost(expectedUrl).reply(config => {
mock.onPost(expectedUrl).reply((config) => {
expect(config.data).toBe(JSON.stringify(expectedData));
return [
......@@ -478,20 +478,20 @@ describe('Api', () => {
];
});
Api.newLabel(namespace, project, labelData, response => {
Api.newLabel(namespace, project, labelData, (response) => {
expect(response.name).toBe('test');
done();
});
});
it('creates a group label', done => {
it('creates a group label', (done) => {
const namespace = 'group/subgroup';
const labelData = { some: 'data' };
const expectedUrl = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespace);
const expectedData = {
label: labelData,
};
mock.onPost(expectedUrl).reply(config => {
mock.onPost(expectedUrl).reply((config) => {
expect(config.data).toBe(JSON.stringify(expectedData));
return [
......@@ -502,7 +502,7 @@ describe('Api', () => {
];
});
Api.newLabel(namespace, undefined, labelData, response => {
Api.newLabel(namespace, undefined, labelData, (response) => {
expect(response.name).toBe('test');
done();
});
......@@ -510,7 +510,7 @@ describe('Api', () => {
});
describe('groupProjects', () => {
it('fetches group projects', done => {
it('fetches group projects', (done) => {
const groupId = '123456';
const query = 'dummy query';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/projects.json`;
......@@ -520,7 +520,7 @@ describe('Api', () => {
},
]);
Api.groupProjects(groupId, query, {}, response => {
Api.groupProjects(groupId, query, {}, (response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
done();
......@@ -561,7 +561,7 @@ describe('Api', () => {
templateKey,
)}`;
it('fetches an issue template', done => {
it('fetches an issue template', (done) => {
mock.onGet(expectedUrl).reply(httpStatus.OK, 'test');
Api.issueTemplate(namespace, project, templateKey, templateType, (error, response) => {
......@@ -587,7 +587,7 @@ describe('Api', () => {
const templateType = 'template type';
const expectedUrl = `${dummyUrlRoot}/${namespace}/${project}/templates/${templateType}`;
it('fetches all templates by type', done => {
it('fetches all templates by type', (done) => {
const expectedData = [
{ key: 'Template1', name: 'Template 1', content: 'This is template 1!' },
];
......@@ -615,12 +615,12 @@ describe('Api', () => {
});
describe('projectTemplates', () => {
it('fetches a list of templates', done => {
it('fetches a list of templates', (done) => {
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/gitlab-org%2Fgitlab-ce/templates/licenses`;
mock.onGet(expectedUrl).reply(httpStatus.OK, 'test');
Api.projectTemplates('gitlab-org/gitlab-ce', 'licenses', {}, response => {
Api.projectTemplates('gitlab-org/gitlab-ce', 'licenses', {}, (response) => {
expect(response).toBe('test');
done();
});
......@@ -628,13 +628,13 @@ describe('Api', () => {
});
describe('projectTemplate', () => {
it('fetches a single template', done => {
it('fetches a single template', (done) => {
const data = { unused: 'option' };
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/gitlab-org%2Fgitlab-ce/templates/licenses/test%20license`;
mock.onGet(expectedUrl).reply(httpStatus.OK, 'test');
Api.projectTemplate('gitlab-org/gitlab-ce', 'licenses', 'test license', data, response => {
Api.projectTemplate('gitlab-org/gitlab-ce', 'licenses', 'test license', data, (response) => {
expect(response).toBe('test');
done();
});
......@@ -642,7 +642,7 @@ describe('Api', () => {
});
describe('users', () => {
it('fetches users', done => {
it('fetches users', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/users.json`;
......@@ -663,7 +663,7 @@ describe('Api', () => {
});
describe('user', () => {
it('fetches single user', done => {
it('fetches single user', (done) => {
const userId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/users/${userId}`;
mock.onGet(expectedUrl).reply(httpStatus.OK, {
......@@ -680,7 +680,7 @@ describe('Api', () => {
});
describe('user counts', () => {
it('fetches single user counts', done => {
it('fetches single user counts', (done) => {
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/user_counts`;
mock.onGet(expectedUrl).reply(httpStatus.OK, {
merge_requests: 4,
......@@ -696,7 +696,7 @@ describe('Api', () => {
});
describe('user status', () => {
it('fetches single user status', done => {
it('fetches single user status', (done) => {
const userId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/users/${userId}/status`;
mock.onGet(expectedUrl).reply(httpStatus.OK, {
......@@ -713,7 +713,7 @@ describe('Api', () => {
});
describe('user projects', () => {
it('fetches all projects that belong to a particular user', done => {
it('fetches all projects that belong to a particular user', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const userId = '123456';
......@@ -724,7 +724,7 @@ describe('Api', () => {
},
]);
Api.userProjects(userId, query, options, response => {
Api.userProjects(userId, query, options, (response) => {
expect(response.length).toBe(1);
expect(response[0].name).toBe('test');
done();
......@@ -733,7 +733,7 @@ describe('Api', () => {
});
describe('commitPipelines', () => {
it('fetches pipelines for a given commit', done => {
it('fetches pipelines for a given commit', (done) => {
const projectId = 'example/foobar';
const commitSha = 'abc123def';
const expectedUrl = `${dummyUrlRoot}/${projectId}/commit/${commitSha}/pipelines`;
......@@ -756,7 +756,7 @@ describe('Api', () => {
describe('pipelineJobs', () => {
it.each([undefined, {}, { foo: true }])(
'fetches the jobs for a given pipeline given %p params',
async params => {
async (params) => {
const projectId = 123;
const pipelineId = 456;
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectId}/pipelines/${pipelineId}/jobs`;
......@@ -774,7 +774,7 @@ describe('Api', () => {
});
describe('createBranch', () => {
it('creates new branch', done => {
it('creates new branch', (done) => {
const ref = 'master';
const branch = 'new-branch-name';
const dummyProjectPath = 'gitlab-org/gitlab-ce';
......@@ -799,7 +799,7 @@ describe('Api', () => {
});
describe('projectForks', () => {
it('gets forked projects', done => {
it('gets forked projects', (done) => {
const dummyProjectPath = 'gitlab-org/gitlab-ce';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${encodeURIComponent(
dummyProjectPath,
......@@ -822,7 +822,7 @@ describe('Api', () => {
});
describe('createContextCommits', () => {
it('creates a new context commit', done => {
it('creates a new context commit', (done) => {
const projectPath = 'abc';
const mergeRequestId = '123456';
const commitsData = ['abcdefg'];
......@@ -851,7 +851,7 @@ describe('Api', () => {
});
describe('allContextCommits', () => {
it('gets all context commits', done => {
it('gets all context commits', (done) => {
const projectPath = 'abc';
const mergeRequestId = '123456';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/projects/${projectPath}/merge_requests/${mergeRequestId}/context_commits`;
......@@ -872,7 +872,7 @@ describe('Api', () => {
});
describe('removeContextCommits', () => {
it('removes context commits', done => {
it('removes context commits', (done) => {
const projectPath = 'abc';
const mergeRequestId = '123456';
const commitsData = ['abcdefg'];
......@@ -1120,7 +1120,7 @@ describe('Api', () => {
});
describe('updateIssue', () => {
it('update an issue with the given payload', done => {
it('update an issue with the given payload', (done) => {
const projectId = 8;
const issue = 1;
const expectedArray = [1, 2, 3];
......@@ -1137,7 +1137,7 @@ describe('Api', () => {
});
describe('updateMergeRequest', () => {
it('update an issue with the given payload', done => {
it('update an issue with the given payload', (done) => {
const projectId = 8;
const mergeRequest = 1;
const expectedArray = [1, 2, 3];
......@@ -1154,7 +1154,7 @@ describe('Api', () => {
});
describe('tags', () => {
it('fetches all tags of a particular project', done => {
it('fetches all tags of a particular project', (done) => {
const query = 'dummy query';
const options = { unused: 'option' };
const projectId = 8;
......
......@@ -34,8 +34,8 @@ describe('RecoveryCodes', () => {
const findAlert = () => wrapper.find(GlAlert);
const findRecoveryCodes = () => wrapper.findByTestId('recovery-codes');
const findCopyButton = () => wrapper.find(ClipboardButton);
const findButtonByText = text =>
wrapper.findAll(GlButton).wrappers.find(buttonWrapper => buttonWrapper.text() === text);
const findButtonByText = (text) =>
wrapper.findAll(GlButton).wrappers.find((buttonWrapper) => buttonWrapper.text() === text);
const findDownloadButton = () => findButtonByText('Download codes');
const findPrintButton = () => findButtonByText('Print codes');
const findProceedButton = () => findButtonByText('Proceed');
......@@ -59,7 +59,7 @@ describe('RecoveryCodes', () => {
it('renders codes', () => {
const recoveryCodes = findRecoveryCodes().text();
codes.forEach(code => {
codes.forEach((code) => {
expect(recoveryCodes).toContain(code);
});
});
......
......@@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => {
window.u2f = oldu2f;
});
it('falls back to normal 2fa', done => {
it('falls back to normal 2fa', (done) => {
component
.start()
.then(() => {
......@@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => {
});
describe('with u2f available', () => {
beforeEach(done => {
beforeEach((done) => {
// bypass automatic form submission within renderAuthenticated
jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true);
u2fDevice = new MockU2FDevice();
......
......@@ -10,7 +10,7 @@ describe('U2FRegister', () => {
preloadFixtures('u2f/register.html');
beforeEach(done => {
beforeEach((done) => {
loadFixtures('u2f/register.html');
u2fDevice = new MockU2FDevice();
container = $('#js-register-token-2fa');
......
......@@ -63,7 +63,7 @@ describe('AwardsHandler', () => {
const $menu = $('.emoji-menu');
return new Promise(resolve => {
return new Promise((resolve) => {
$menu.one('build-emoji-menu-finish', () => {
resolve();
});
......@@ -356,7 +356,7 @@ describe('AwardsHandler', () => {
await openAndWaitForEmojiMenu();
const emojiMenu = document.querySelector('.emoji-menu');
Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), title => {
Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), (title) => {
expect(title.textContent.trim().toLowerCase()).not.toBe('frequently used');
});
});
......@@ -369,7 +369,7 @@ describe('AwardsHandler', () => {
const emojiMenu = document.querySelector('.emoji-menu');
const hasFrequentlyUsedHeading = Array.prototype.some.call(
emojiMenu.querySelectorAll('.emoji-menu-title'),
title => title.textContent.trim().toLowerCase() === 'frequently used',
(title) => title.textContent.trim().toLowerCase() === 'frequently used',
);
expect(hasFrequentlyUsedHeading).toBe(true);
......
......@@ -50,7 +50,7 @@ describe('BadgeForm component', () => {
});
});
const sharedSubmitTests = submitAction => {
const sharedSubmitTests = (submitAction) => {
const nameSelector = '#badge-name';
const imageUrlSelector = '#badge-image-url';
const findImageUrlElement = () => vm.$el.querySelector(imageUrlSelector);
......@@ -65,7 +65,7 @@ describe('BadgeForm component', () => {
const submitButton = vm.$el.querySelector('button[type="submit"]');
submitButton.click();
};
const expectInvalidInput = inputElementSelector => {
const expectInvalidInput = (inputElementSelector) => {
const inputElement = vm.$el.querySelector(inputElementSelector);
expect(inputElement.checkValidity()).toBe(false);
......@@ -74,7 +74,7 @@ describe('BadgeForm component', () => {
expect(feedbackElement).toBeVisible();
};
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(vm, submitAction).mockReturnValue(Promise.resolve());
store.replaceState({
...store.state,
......
......@@ -73,7 +73,7 @@ describe('BadgeListRow component', () => {
expect(vm.editBadge).toHaveBeenCalled();
});
it('calls updateBadgeInModal and shows modal when clicking then delete button', done => {
it('calls updateBadgeInModal and shows modal when clicking then delete button', (done) => {
jest.spyOn(vm, 'updateBadgeInModal').mockImplementation(() => {});
const deleteButton = vm.$el.querySelector('.table-button-footer button:last-of-type');
......@@ -88,7 +88,7 @@ describe('BadgeListRow component', () => {
});
describe('for a group badge', () => {
beforeEach(done => {
beforeEach((done) => {
badge.kind = GROUP_BADGE;
Vue.nextTick().then(done).catch(done.fail);
......
......@@ -48,7 +48,7 @@ describe('BadgeList component', () => {
expect(rows).toHaveLength(numberOfDummyBadges);
});
it('renders a message if no badges exist', done => {
it('renders a message if no badges exist', (done) => {
store.state.badges = [];
Vue.nextTick()
......@@ -59,7 +59,7 @@ describe('BadgeList component', () => {
.catch(done.fail);
});
it('shows a loading icon when loading', done => {
it('shows a loading icon when loading', (done) => {
store.state.isLoading = true;
Vue.nextTick()
......@@ -73,13 +73,13 @@ describe('BadgeList component', () => {
});
describe('for group badges', () => {
beforeEach(done => {
beforeEach((done) => {
store.state.kind = GROUP_BADGE;
Vue.nextTick().then(done).catch(done.fail);
});
it('renders a message if no badges exist', done => {
it('renders a message if no badges exist', (done) => {
store.state.badges = [];
Vue.nextTick()
......
......@@ -23,7 +23,7 @@ describe('Badge component', () => {
const createComponent = (props, el = null) => {
vm = mountComponent(Component, props, el);
const { badgeImage } = findElements();
return new Promise(resolve => {
return new Promise((resolve) => {
badgeImage.addEventListener('load', resolve);
// Manually dispatch load event as it is not triggered
badgeImage.dispatchEvent(new Event('load'));
......@@ -36,7 +36,7 @@ describe('Badge component', () => {
describe('watchers', () => {
describe('imageUrl', () => {
it('sets isLoading and resets numRetries and hasError', done => {
it('sets isLoading and resets numRetries and hasError', (done) => {
const props = { ...dummyProps };
createComponent(props)
.then(() => {
......@@ -60,7 +60,7 @@ describe('Badge component', () => {
});
describe('methods', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ ...dummyProps })
.then(done)
.catch(done.fail);
......@@ -98,7 +98,7 @@ describe('Badge component', () => {
});
describe('behavior', () => {
beforeEach(done => {
beforeEach((done) => {
setFixtures('<div id="dummy-element"></div>');
createComponent({ ...dummyProps }, '#dummy-element')
.then(done)
......@@ -116,7 +116,7 @@ describe('Badge component', () => {
expect(vm.$el.querySelector('.btn-group')).toBeHidden();
});
it('shows a loading icon when loading', done => {
it('shows a loading icon when loading', (done) => {
vm.isLoading = true;
Vue.nextTick()
......@@ -132,7 +132,7 @@ describe('Badge component', () => {
.catch(done.fail);
});
it('shows an error and reload button if loading failed', done => {
it('shows an error and reload button if loading failed', (done) => {
vm.hasError = true;
Vue.nextTick()
......
......@@ -33,7 +33,7 @@ describe('Badges store actions', () => {
});
describe('requestNewBadge', () => {
it('commits REQUEST_NEW_BADGE', done => {
it('commits REQUEST_NEW_BADGE', (done) => {
testAction(
actions.requestNewBadge,
null,
......@@ -46,7 +46,7 @@ describe('Badges store actions', () => {
});
describe('receiveNewBadge', () => {
it('commits RECEIVE_NEW_BADGE', done => {
it('commits RECEIVE_NEW_BADGE', (done) => {
const newBadge = createDummyBadge();
testAction(
actions.receiveNewBadge,
......@@ -60,7 +60,7 @@ describe('Badges store actions', () => {
});
describe('receiveNewBadgeError', () => {
it('commits RECEIVE_NEW_BADGE_ERROR', done => {
it('commits RECEIVE_NEW_BADGE_ERROR', (done) => {
testAction(
actions.receiveNewBadgeError,
null,
......@@ -87,10 +87,10 @@ describe('Badges store actions', () => {
};
});
it('dispatches requestNewBadge and receiveNewBadge for successful response', done => {
it('dispatches requestNewBadge and receiveNewBadge for successful response', (done) => {
const dummyResponse = createDummyBadgeResponse();
endpointMock.replyOnce(req => {
endpointMock.replyOnce((req) => {
expect(req.data).toBe(
JSON.stringify({
name: 'TestBadge',
......@@ -114,8 +114,8 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('dispatches requestNewBadge and receiveNewBadgeError for error response', done => {
endpointMock.replyOnce(req => {
it('dispatches requestNewBadge and receiveNewBadgeError for error response', (done) => {
endpointMock.replyOnce((req) => {
expect(req.data).toBe(
JSON.stringify({
name: 'TestBadge',
......@@ -141,7 +141,7 @@ describe('Badges store actions', () => {
});
describe('requestDeleteBadge', () => {
it('commits REQUEST_DELETE_BADGE', done => {
it('commits REQUEST_DELETE_BADGE', (done) => {
testAction(
actions.requestDeleteBadge,
badgeId,
......@@ -154,7 +154,7 @@ describe('Badges store actions', () => {
});
describe('receiveDeleteBadge', () => {
it('commits RECEIVE_DELETE_BADGE', done => {
it('commits RECEIVE_DELETE_BADGE', (done) => {
testAction(
actions.receiveDeleteBadge,
badgeId,
......@@ -167,7 +167,7 @@ describe('Badges store actions', () => {
});
describe('receiveDeleteBadgeError', () => {
it('commits RECEIVE_DELETE_BADGE_ERROR', done => {
it('commits RECEIVE_DELETE_BADGE_ERROR', (done) => {
testAction(
actions.receiveDeleteBadgeError,
badgeId,
......@@ -188,7 +188,7 @@ describe('Badges store actions', () => {
dispatch = jest.fn();
});
it('dispatches requestDeleteBadge and receiveDeleteBadge for successful response', done => {
it('dispatches requestDeleteBadge and receiveDeleteBadge for successful response', (done) => {
endpointMock.replyOnce(() => {
expect(dispatch.mock.calls).toEqual([['requestDeleteBadge', badgeId]]);
dispatch.mockClear();
......@@ -204,7 +204,7 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('dispatches requestDeleteBadge and receiveDeleteBadgeError for error response', done => {
it('dispatches requestDeleteBadge and receiveDeleteBadgeError for error response', (done) => {
endpointMock.replyOnce(() => {
expect(dispatch.mock.calls).toEqual([['requestDeleteBadge', badgeId]]);
dispatch.mockClear();
......@@ -223,7 +223,7 @@ describe('Badges store actions', () => {
});
describe('editBadge', () => {
it('commits START_EDITING', done => {
it('commits START_EDITING', (done) => {
const dummyBadge = createDummyBadge();
testAction(
actions.editBadge,
......@@ -237,7 +237,7 @@ describe('Badges store actions', () => {
});
describe('requestLoadBadges', () => {
it('commits REQUEST_LOAD_BADGES', done => {
it('commits REQUEST_LOAD_BADGES', (done) => {
const dummyData = 'this is not real data';
testAction(
actions.requestLoadBadges,
......@@ -251,7 +251,7 @@ describe('Badges store actions', () => {
});
describe('receiveLoadBadges', () => {
it('commits RECEIVE_LOAD_BADGES', done => {
it('commits RECEIVE_LOAD_BADGES', (done) => {
const badges = dummyBadges;
testAction(
actions.receiveLoadBadges,
......@@ -265,7 +265,7 @@ describe('Badges store actions', () => {
});
describe('receiveLoadBadgesError', () => {
it('commits RECEIVE_LOAD_BADGES_ERROR', done => {
it('commits RECEIVE_LOAD_BADGES_ERROR', (done) => {
testAction(
actions.receiveLoadBadgesError,
null,
......@@ -286,7 +286,7 @@ describe('Badges store actions', () => {
dispatch = jest.fn();
});
it('dispatches requestLoadBadges and receiveLoadBadges for successful response', done => {
it('dispatches requestLoadBadges and receiveLoadBadges for successful response', (done) => {
const dummyData = 'this is just some data';
const dummyReponse = [
createDummyBadgeResponse(),
......@@ -310,7 +310,7 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('dispatches requestLoadBadges and receiveLoadBadgesError for error response', done => {
it('dispatches requestLoadBadges and receiveLoadBadgesError for error response', (done) => {
const dummyData = 'this is just some data';
endpointMock.replyOnce(() => {
expect(dispatch.mock.calls).toEqual([['requestLoadBadges', dummyData]]);
......@@ -330,7 +330,7 @@ describe('Badges store actions', () => {
});
describe('requestRenderedBadge', () => {
it('commits REQUEST_RENDERED_BADGE', done => {
it('commits REQUEST_RENDERED_BADGE', (done) => {
testAction(
actions.requestRenderedBadge,
null,
......@@ -343,7 +343,7 @@ describe('Badges store actions', () => {
});
describe('receiveRenderedBadge', () => {
it('commits RECEIVE_RENDERED_BADGE', done => {
it('commits RECEIVE_RENDERED_BADGE', (done) => {
const dummyBadge = createDummyBadge();
testAction(
actions.receiveRenderedBadge,
......@@ -357,7 +357,7 @@ describe('Badges store actions', () => {
});
describe('receiveRenderedBadgeError', () => {
it('commits RECEIVE_RENDERED_BADGE_ERROR', done => {
it('commits RECEIVE_RENDERED_BADGE_ERROR', (done) => {
testAction(
actions.receiveRenderedBadgeError,
null,
......@@ -388,7 +388,7 @@ describe('Badges store actions', () => {
dispatch = jest.fn();
});
it('returns immediately if imageUrl is empty', done => {
it('returns immediately if imageUrl is empty', (done) => {
jest.spyOn(axios, 'get').mockImplementation(() => {});
badgeInForm.imageUrl = '';
......@@ -401,7 +401,7 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('returns immediately if linkUrl is empty', done => {
it('returns immediately if linkUrl is empty', (done) => {
jest.spyOn(axios, 'get').mockImplementation(() => {});
badgeInForm.linkUrl = '';
......@@ -414,7 +414,7 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('escapes user input', done => {
it('escapes user input', (done) => {
jest
.spyOn(axios, 'get')
.mockImplementation(() => Promise.resolve({ data: createDummyBadgeResponse() }));
......@@ -437,7 +437,7 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('dispatches requestRenderedBadge and receiveRenderedBadge for successful response', done => {
it('dispatches requestRenderedBadge and receiveRenderedBadge for successful response', (done) => {
const dummyReponse = createDummyBadgeResponse();
endpointMock.replyOnce(() => {
expect(dispatch.mock.calls).toEqual([['requestRenderedBadge']]);
......@@ -456,7 +456,7 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('dispatches requestRenderedBadge and receiveRenderedBadgeError for error response', done => {
it('dispatches requestRenderedBadge and receiveRenderedBadgeError for error response', (done) => {
endpointMock.replyOnce(() => {
expect(dispatch.mock.calls).toEqual([['requestRenderedBadge']]);
dispatch.mockClear();
......@@ -475,7 +475,7 @@ describe('Badges store actions', () => {
});
describe('requestUpdatedBadge', () => {
it('commits REQUEST_UPDATED_BADGE', done => {
it('commits REQUEST_UPDATED_BADGE', (done) => {
testAction(
actions.requestUpdatedBadge,
null,
......@@ -488,7 +488,7 @@ describe('Badges store actions', () => {
});
describe('receiveUpdatedBadge', () => {
it('commits RECEIVE_UPDATED_BADGE', done => {
it('commits RECEIVE_UPDATED_BADGE', (done) => {
const updatedBadge = createDummyBadge();
testAction(
actions.receiveUpdatedBadge,
......@@ -502,7 +502,7 @@ describe('Badges store actions', () => {
});
describe('receiveUpdatedBadgeError', () => {
it('commits RECEIVE_UPDATED_BADGE_ERROR', done => {
it('commits RECEIVE_UPDATED_BADGE_ERROR', (done) => {
testAction(
actions.receiveUpdatedBadgeError,
null,
......@@ -529,10 +529,10 @@ describe('Badges store actions', () => {
dispatch = jest.fn();
});
it('dispatches requestUpdatedBadge and receiveUpdatedBadge for successful response', done => {
it('dispatches requestUpdatedBadge and receiveUpdatedBadge for successful response', (done) => {
const dummyResponse = createDummyBadgeResponse();
endpointMock.replyOnce(req => {
endpointMock.replyOnce((req) => {
expect(req.data).toBe(
JSON.stringify({
name: 'TestBadge',
......@@ -556,8 +556,8 @@ describe('Badges store actions', () => {
.catch(done.fail);
});
it('dispatches requestUpdatedBadge and receiveUpdatedBadgeError for error response', done => {
endpointMock.replyOnce(req => {
it('dispatches requestUpdatedBadge and receiveUpdatedBadgeError for error response', (done) => {
endpointMock.replyOnce((req) => {
expect(req.data).toBe(
JSON.stringify({
name: 'TestBadge',
......@@ -583,7 +583,7 @@ describe('Badges store actions', () => {
});
describe('stopEditing', () => {
it('commits STOP_EDITING', done => {
it('commits STOP_EDITING', (done) => {
testAction(
actions.stopEditing,
null,
......@@ -596,7 +596,7 @@ describe('Badges store actions', () => {
});
describe('updateBadgeInForm', () => {
it('commits UPDATE_BADGE_IN_FORM', done => {
it('commits UPDATE_BADGE_IN_FORM', (done) => {
const dummyBadge = createDummyBadge();
testAction(
actions.updateBadgeInForm,
......@@ -609,7 +609,7 @@ describe('Badges store actions', () => {
});
describe('updateBadgeInModal', () => {
it('commits UPDATE_BADGE_IN_MODAL', done => {
it('commits UPDATE_BADGE_IN_MODAL', (done) => {
const dummyBadge = createDummyBadge();
testAction(
actions.updateBadgeInModal,
......
......@@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => {
);
});
it('sets as loading when draft is publishing', done => {
it('sets as loading when draft is publishing', (done) => {
createComponent();
wrapper.vm.$store.state.batchComments.currentlyPublishingDrafts.push(1);
......@@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => {
});
describe('update', () => {
it('dispatches updateDraft', done => {
it('dispatches updateDraft', (done) => {
createComponent();
const note = wrapper.find(NoteableNote);
......@@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => {
});
describe('quick actions', () => {
it('renders referenced commands', done => {
it('renders referenced commands', (done) => {
createComponent();
wrapper.setProps({
draft: {
......
......@@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => {
expect(vm.$el.textContent).toContain('1');
});
it('renders screen reader text', done => {
it('renders screen reader text', (done) => {
const el = vm.$el.querySelector('.sr-only');
expect(el.textContent).toContain('draft');
......
......@@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => {
describe('for thread', () => {
beforeEach(() => {
createComponent(false, { discussion_id: '1', resolve_discussion: true }, store => {
createComponent(false, { discussion_id: '1', resolve_discussion: true }, (store) => {
store.state.notes.discussions.push({
id: '1',
notes: [
......
......@@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => {
expect(vm.$store.dispatch).toHaveBeenCalledWith('batchComments/publishReview', undefined);
});
it('sets loading when isPublishing is true', done => {
it('sets loading when isPublishing is true', (done) => {
vm.$store.state.batchComments.isPublishing = true;
vm.$nextTick(() => {
......
......@@ -28,7 +28,7 @@ describe('Batch comments store actions', () => {
});
describe('addDraftToDiscussion', () => {
it('commits ADD_NEW_DRAFT if no errors returned', done => {
it('commits ADD_NEW_DRAFT if no errors returned', (done) => {
res = { id: 1 };
mock.onAny().reply(200, res);
......@@ -42,7 +42,7 @@ describe('Batch comments store actions', () => {
);
});
it('does not commit ADD_NEW_DRAFT if errors returned', done => {
it('does not commit ADD_NEW_DRAFT if errors returned', (done) => {
mock.onAny().reply(500);
testAction(
......@@ -57,7 +57,7 @@ describe('Batch comments store actions', () => {
});
describe('createNewDraft', () => {
it('commits ADD_NEW_DRAFT if no errors returned', done => {
it('commits ADD_NEW_DRAFT if no errors returned', (done) => {
res = { id: 1 };
mock.onAny().reply(200, res);
......@@ -71,7 +71,7 @@ describe('Batch comments store actions', () => {
);
});
it('does not commit ADD_NEW_DRAFT if errors returned', done => {
it('does not commit ADD_NEW_DRAFT if errors returned', (done) => {
mock.onAny().reply(500);
testAction(actions.createNewDraft, { endpoint: TEST_HOST, data: 'test' }, null, [], [], done);
......@@ -89,7 +89,7 @@ describe('Batch comments store actions', () => {
};
});
it('commits DELETE_DRAFT if no errors returned', done => {
it('commits DELETE_DRAFT if no errors returned', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -107,7 +107,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail);
});
it('does not commit DELETE_DRAFT if errors returned', done => {
it('does not commit DELETE_DRAFT if errors returned', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -136,7 +136,7 @@ describe('Batch comments store actions', () => {
};
});
it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', done => {
it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -170,7 +170,7 @@ describe('Batch comments store actions', () => {
rootGetters = { discussionsStructuredByLineCode: 'discussions' };
});
it('dispatches actions & commits', done => {
it('dispatches actions & commits', (done) => {
mock.onAny().reply(200);
actions
......@@ -185,7 +185,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail);
});
it('dispatches error commits', done => {
it('dispatches error commits', (done) => {
mock.onAny().reply(500);
actions
......@@ -210,7 +210,7 @@ describe('Batch comments store actions', () => {
};
});
it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', done => {
it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -228,7 +228,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail);
});
it('calls passed callback', done => {
it('calls passed callback', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -249,7 +249,7 @@ describe('Batch comments store actions', () => {
});
describe('expandAllDiscussions', () => {
it('dispatches expandDiscussion for all drafts', done => {
it('dispatches expandDiscussion for all drafts', (done) => {
const state = {
drafts: [
{
......
......@@ -6,7 +6,7 @@ function load() {
jest.mock('~/helpers/startup_css_helper', () => {
return {
waitForCSSLoaded: jest.fn().mockImplementation(cb => cb.apply()),
waitForCSSLoaded: jest.fn().mockImplementation((cb) => cb.apply()),
};
});
......
......@@ -57,7 +57,7 @@ describe('CopyAsGFM', () => {
const fragment = document.createDocumentFragment();
const node = document.createElement('div');
node.innerHTML = html;
Array.from(node.childNodes).forEach(item => fragment.appendChild(item));
Array.from(node.childNodes).forEach((item) => fragment.appendChild(item));
return fragment;
},
}),
......@@ -80,7 +80,7 @@ describe('CopyAsGFM', () => {
return clipboardData;
};
beforeAll(done => {
beforeAll((done) => {
initCopyAsGFM();
// Fake call to nodeToGfm so the import of lazy bundle happened
......@@ -94,7 +94,7 @@ describe('CopyAsGFM', () => {
beforeEach(() => jest.spyOn(clipboardData, 'setData'));
describe('list handling', () => {
it('uses correct gfm for unordered lists', done => {
it('uses correct gfm for unordered lists', (done) => {
const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'UL');
window.getSelection = jest.fn(() => selection);
......@@ -108,7 +108,7 @@ describe('CopyAsGFM', () => {
});
});
it('uses correct gfm for ordered lists', done => {
it('uses correct gfm for ordered lists', (done) => {
const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'OL');
window.getSelection = jest.fn(() => selection);
......@@ -127,7 +127,7 @@ describe('CopyAsGFM', () => {
describe('CopyAsGFM.quoted', () => {
const sampleGFM = '* List 1\n* List 2\n\n`Some code`';
it('adds quote char `> ` to each line', done => {
it('adds quote char `> ` to each line', (done) => {
const expectedQuotedGFM = '> * List 1\n> * List 2\n> \n> `Some code`';
expect(CopyAsGFM.quoted(sampleGFM)).toEqual(expectedQuotedGFM);
done();
......
......@@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => {
const setupListeners = () => {
document
.querySelectorAll('link')
.forEach(x => x.addEventListener('load', () => loadListener(x)));
.forEach((x) => x.addEventListener('load', () => loadListener(x)));
};
beforeEach(() => {
......
......@@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => {
Object.defineProperty(event, 'dataTransfer', {
value: {
getData: jest.fn().mockImplementation(type => {
getData: jest.fn().mockImplementation((type) => {
if (type === 'text/html') {
return '<table><tr><td>First</td><td>Second</td></tr></table>';
}
......@@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => {
it('returns false when the number of rows are not consistent', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(mimeType => {
data.getData = jest.fn().mockImplementation((mimeType) => {
if (mimeType === 'text/html') {
return '<table><tr><td>def test<td></tr></table>';
}
......@@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => {
it('returns false when the table copy comes from a diff', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(mimeType => {
data.getData = jest.fn().mockImplementation((mimeType) => {
if (mimeType === 'text/html') {
return '<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>';
}
......@@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => {
describe('convertToTableMarkdown', () => {
it('returns a Markdown table', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(type => {
data.getData = jest.fn().mockImplementation((type) => {
if (type === 'text/html') {
return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>';
} else if (type === 'text/plain') {
......@@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => {
it('returns a Markdown table with rows normalized', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(type => {
data.getData = jest.fn().mockImplementation((type) => {
if (type === 'text/html') {
return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>';
} else if (type === 'text/plain') {
......
......@@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => {
submit: jest.fn(),
};
$('form').submit(e => {
$('form').submit((e) => {
// Prevent a form submit from moving us off the testing page
e.preventDefault();
// Explicitly call the spie to know this function get's not called
......
......@@ -18,7 +18,7 @@ function generateValueMarkup(
function generateFixtureMarkup(secrets, isRevealed, valueClass, placeholderClass) {
return `
<div class="js-secret-container">
${secrets.map(secret => generateValueMarkup(secret, valueClass, placeholderClass)).join('')}
${secrets.map((secret) => generateValueMarkup(secret, valueClass, placeholderClass)).join('')}
<button
class="js-secret-value-reveal-button"
data-secret-reveal-status="${isRevealed}"
......@@ -122,12 +122,12 @@ describe('setupSecretValues', () => {
const placeholders = wrapper.querySelectorAll('.js-secret-value-placeholder');
expect(values.length).toEqual(3);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......@@ -141,24 +141,24 @@ describe('setupSecretValues', () => {
revealButton.click();
expect(values.length).toEqual(3);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(false);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(true);
});
revealButton.click();
expect(values.length).toEqual(3);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......@@ -181,24 +181,24 @@ describe('setupSecretValues', () => {
revealButton.click();
expect(values.length).toEqual(4);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(false);
});
expect(placeholders.length).toEqual(4);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(true);
});
revealButton.click();
expect(values.length).toEqual(4);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(4);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......
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