Commit 557c22a8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 46 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 7f4e951c
...@@ -1369,40 +1369,6 @@ ee/app/assets/javascripts/vulnerabilities/components/resolution_alert.vue ...@@ -1369,40 +1369,6 @@ ee/app/assets/javascripts/vulnerabilities/components/resolution_alert.vue
ee/app/assets/javascripts/vulnerabilities/helpers.js ee/app/assets/javascripts/vulnerabilities/helpers.js
ee/app/assets/javascripts/vulnerabilities/vulnerabilities_init.js ee/app/assets/javascripts/vulnerabilities/vulnerabilities_init.js
## keen-napier
ee/spec/frontend/boards/components/assignee_select_spec.js
ee/spec/frontend/boards/components/board_list_header_new_spec.js
ee/spec/frontend/boards/components/board_list_header_spec.js
ee/spec/frontend/boards/components/board_list_selector/board_list_selector_spec.js
ee/spec/frontend/boards/components/board_list_spec.js
ee/spec/frontend/boards/components/board_setting_list_types_spec.js
ee/spec/frontend/boards/components/board_settings_wip_limit_spec.js
ee/spec/frontend/boards/components/epic_lane_spec.js
ee/spec/frontend/boards/components/sidebar/board_sidebar_epic_select_spec.js
ee/spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js
ee/spec/frontend/boards/components/weight_select_spec.js
ee/spec/frontend/boards/milestone_select_spec.js
ee/spec/frontend/boards/mock_data.js
ee/spec/frontend/boards/stores/actions_spec.js
ee/spec/frontend/boards/stores/boards_store_ee_spec.js
ee/spec/frontend/boards/stores/mutations_spec.js
ee/spec/frontend/burndown_chart/components/burn_charts_spec.js
ee/spec/frontend/codequality_report/store/actions_spec.js
ee/spec/frontend/compliance_dashboard/components/empty_state_spec.js
ee/spec/frontend/compliance_dashboard/components/merge_requests/branch_details_spec.js
ee/spec/frontend/compliance_dashboard/components/merge_requests/grid_spec.js
ee/spec/frontend/compliance_dashboard/components/merge_requests/merge_request_spec.js
ee/spec/frontend/compliance_dashboard/components/merge_requests/status_spec.js
ee/spec/frontend/compliance_dashboard/components/merge_requests/statuses/approval_spec.js
ee/spec/frontend/compliance_dashboard/components/merge_requests/statuses/pipeline_spec.js
ee/spec/frontend/compliance_dashboard/components/shared/grid_column_heading_spec.js
ee/spec/frontend/compliance_dashboard/components/shared/pagination_spec.js
ee/spec/frontend/compliance_dashboard/mock_data.js
ee/spec/frontend/dependencies/components/app_spec.js
ee/spec/frontend/dependencies/components/dependencies_actions_spec.js
ee/spec/frontend/dependencies/components/dependency_license_links_spec.js
ee/spec/frontend/dependencies/components/dependency_list_job_failed_alert_spec.js
## gallant-ride ## gallant-ride
ee/spec/frontend/diffs/components/diff_line_note_form_spec.js ee/spec/frontend/diffs/components/diff_line_note_form_spec.js
ee/spec/frontend/environments/canary_ingress_spec.js ee/spec/frontend/environments/canary_ingress_spec.js
......
...@@ -31,7 +31,7 @@ const assignee2 = { ...@@ -31,7 +31,7 @@ const assignee2 = {
}; };
describe('Assignee select component', () => { describe('Assignee select component', () => {
beforeEach(done => { beforeEach((done) => {
setFixtures('<div class="test-container"></div>'); setFixtures('<div class="test-container"></div>');
boardsStore.create(); boardsStore.create();
...@@ -55,7 +55,7 @@ describe('Assignee select component', () => { ...@@ -55,7 +55,7 @@ describe('Assignee select component', () => {
}); });
describe('canEdit', () => { describe('canEdit', () => {
it('hides Edit button', done => { it('hides Edit button', (done) => {
vm.canEdit = false; vm.canEdit = false;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeFalsy(); expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
...@@ -63,7 +63,7 @@ describe('Assignee select component', () => { ...@@ -63,7 +63,7 @@ describe('Assignee select component', () => {
}); });
}); });
it('shows Edit button if true', done => { it('shows Edit button if true', (done) => {
vm.canEdit = true; vm.canEdit = true;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeTruthy(); expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
...@@ -77,7 +77,7 @@ describe('Assignee select component', () => { ...@@ -77,7 +77,7 @@ describe('Assignee select component', () => {
expect(selectedText()).toContain('Any assignee'); expect(selectedText()).toContain('Any assignee');
}); });
it('shows selected assignee', done => { it('shows selected assignee', (done) => {
vm.selected = assignee; vm.selected = assignee;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(selectedText()).toContain('first assignee'); expect(selectedText()).toContain('first assignee');
...@@ -97,7 +97,7 @@ describe('Assignee select component', () => { ...@@ -97,7 +97,7 @@ describe('Assignee select component', () => {
mock.restore(); mock.restore();
}); });
it('sets assignee', done => { it('sets assignee', (done) => {
vm.$el.querySelector('.edit-link').click(); vm.$el.querySelector('.edit-link').click();
jest.runOnlyPendingTimers(); jest.runOnlyPendingTimers();
......
...@@ -75,13 +75,13 @@ describe('Board List Header Component', () => { ...@@ -75,13 +75,13 @@ describe('Board List Header Component', () => {
const hasSettings = [ListType.assignee, ListType.milestone, ListType.label]; const hasSettings = [ListType.assignee, ListType.milestone, ListType.label];
const hasNoSettings = [ListType.backlog, ListType.closed]; const hasNoSettings = [ListType.backlog, ListType.closed];
it.each(hasSettings)('does render for List Type `%s`', listType => { it.each(hasSettings)('does render for List Type `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findSettingsButton().exists()).toBe(true); expect(findSettingsButton().exists()).toBe(true);
}); });
it.each(hasNoSettings)('does not render for List Type `%s`', listType => { it.each(hasNoSettings)('does not render for List Type `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findSettingsButton().exists()).toBe(false); expect(findSettingsButton().exists()).toBe(false);
...@@ -90,7 +90,7 @@ describe('Board List Header Component', () => { ...@@ -90,7 +90,7 @@ describe('Board List Header Component', () => {
it('has a test for each list type', () => { it('has a test for each list type', () => {
createComponent(); createComponent();
Object.values(ListType).forEach(value => { Object.values(ListType).forEach((value) => {
expect([...hasSettings, ...hasNoSettings]).toContain(value); expect([...hasSettings, ...hasNoSettings]).toContain(value);
}); });
}); });
......
...@@ -84,20 +84,20 @@ describe('Board List Header Component', () => { ...@@ -84,20 +84,20 @@ describe('Board List Header Component', () => {
const hasSettings = [ListType.assignee, ListType.milestone, ListType.label]; const hasSettings = [ListType.assignee, ListType.milestone, ListType.label];
const hasNoSettings = [ListType.backlog, ListType.closed]; const hasNoSettings = [ListType.backlog, ListType.closed];
it.each(hasSettings)('does render for List Type `%s`', listType => { it.each(hasSettings)('does render for List Type `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findSettingsButton().exists()).toBe(true); expect(findSettingsButton().exists()).toBe(true);
}); });
it.each(hasNoSettings)('does not render for List Type `%s`', listType => { it.each(hasNoSettings)('does not render for List Type `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findSettingsButton().exists()).toBe(false); expect(findSettingsButton().exists()).toBe(false);
}); });
it('has a test for each list type', () => { it('has a test for each list type', () => {
Object.values(ListType).forEach(value => { Object.values(ListType).forEach((value) => {
expect([...hasSettings, ...hasNoSettings]).toContain(value); expect([...hasSettings, ...hasNoSettings]).toContain(value);
}); });
}); });
......
...@@ -51,7 +51,7 @@ describe('BoardListSelector', () => { ...@@ -51,7 +51,7 @@ describe('BoardListSelector', () => {
describe('methods', () => { describe('methods', () => {
describe('loadList', () => { describe('loadList', () => {
it('calls axios.get and sets response to store.state.assignees', done => { it('calls axios.get and sets response to store.state.assignees', (done) => {
mock.onGet(dummyEndpoint).reply(200, mockAssigneesList); mock.onGet(dummyEndpoint).reply(200, mockAssigneesList);
boardsStore.state.assignees = []; boardsStore.state.assignees = [];
...@@ -64,7 +64,7 @@ describe('BoardListSelector', () => { ...@@ -64,7 +64,7 @@ describe('BoardListSelector', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not call axios.get when store.state.assignees is not empty', done => { it('does not call axios.get when store.state.assignees is not empty', (done) => {
jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve()); jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve());
boardsStore.state.assignees = mockAssigneesList; boardsStore.state.assignees = mockAssigneesList;
...@@ -76,7 +76,7 @@ describe('BoardListSelector', () => { ...@@ -76,7 +76,7 @@ describe('BoardListSelector', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls axios.get and shows Flash error when request fails', done => { it('calls axios.get and shows Flash error when request fails', (done) => {
mock.onGet(dummyEndpoint).replyOnce(500, {}); mock.onGet(dummyEndpoint).replyOnce(500, {});
boardsStore.state.assignees = []; boardsStore.state.assignees = [];
......
...@@ -4,7 +4,7 @@ describe('BoardList Component', () => { ...@@ -4,7 +4,7 @@ describe('BoardList Component', () => {
let mock; let mock;
let component; let component;
beforeEach(done => { beforeEach((done) => {
const listIssueProps = { const listIssueProps = {
project: { project: {
path: '/test', path: '/test',
......
...@@ -11,7 +11,7 @@ describe('BoardSettingsListType', () => { ...@@ -11,7 +11,7 @@ describe('BoardSettingsListType', () => {
}, },
assignee: { webUrl: 'https://gitlab.com/root', name: 'root', username: 'root' }, assignee: { webUrl: 'https://gitlab.com/root', name: 'root', username: 'root' },
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(BoardSettingsListTypes, { wrapper = shallowMount(BoardSettingsListTypes, {
propsData: { ...props, activeList }, propsData: { ...props, activeList },
}); });
......
...@@ -62,7 +62,7 @@ describe('BoardSettingsWipLimit', () => { ...@@ -62,7 +62,7 @@ describe('BoardSettingsWipLimit', () => {
}); });
}; };
const triggerBlur = type => { const triggerBlur = (type) => {
if (type === 'blur') { if (type === 'blur') {
findInput().vm.$emit('blur'); findInput().vm.$emit('blur');
} }
......
...@@ -12,7 +12,7 @@ localVue.use(Vuex); ...@@ -12,7 +12,7 @@ localVue.use(Vuex);
describe('EpicLane', () => { describe('EpicLane', () => {
let wrapper; let wrapper;
const findByTestId = testId => wrapper.find(`[data-testid="${testId}"]`); const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const updateBoardEpicUserPreferencesSpy = jest.fn(); const updateBoardEpicUserPreferencesSpy = jest.fn();
......
...@@ -8,7 +8,7 @@ const TEST_EPIC_ID = 8; ...@@ -8,7 +8,7 @@ const TEST_EPIC_ID = 8;
const TEST_EPIC = { id: 'gid://gitlab/Epic/1', title: 'Test epic' }; const TEST_EPIC = { id: 'gid://gitlab/Epic/1', title: 'Test epic' };
const TEST_ISSUE = { id: 'gid://gitlab/Issue/1', iid: 9, epic: null, referencePath: 'h/b#2' }; const TEST_ISSUE = { id: 'gid://gitlab/Issue/1', iid: 9, epic: null, referencePath: 'h/b#2' };
jest.mock('~/lib/utils/common_utils', () => ({ debounceByAnimationFrame: callback => callback })); jest.mock('~/lib/utils/common_utils', () => ({ debounceByAnimationFrame: (callback) => callback }));
describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => { describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
let wrapper; let wrapper;
......
...@@ -15,7 +15,7 @@ describe('BoardSidebarTimeTracker', () => { ...@@ -15,7 +15,7 @@ describe('BoardSidebarTimeTracker', () => {
let wrapper; let wrapper;
let store; let store;
const createComponent = options => { const createComponent = (options) => {
wrapper = shallowMount(BoardSidebarTimeTracker, { wrapper = shallowMount(BoardSidebarTimeTracker, {
store, store,
...options, ...options,
...@@ -42,7 +42,7 @@ describe('BoardSidebarTimeTracker', () => { ...@@ -42,7 +42,7 @@ describe('BoardSidebarTimeTracker', () => {
it.each([[true], [false]])( it.each([[true], [false]])(
'renders IssuableTimeTracker with correct spent and estimated time (timeTrackingLimitToHours=%s)', 'renders IssuableTimeTracker with correct spent and estimated time (timeTrackingLimitToHours=%s)',
timeTrackingLimitToHours => { (timeTrackingLimitToHours) => {
createComponent({ provide: { timeTrackingLimitToHours } }); createComponent({ provide: { timeTrackingLimitToHours } });
expect(wrapper.find(IssuableTimeTracker).props()).toEqual({ expect(wrapper.find(IssuableTimeTracker).props()).toEqual({
......
...@@ -8,7 +8,7 @@ describe('WeightSelect', () => { ...@@ -8,7 +8,7 @@ describe('WeightSelect', () => {
const editButton = () => wrapper.find(GlButton); const editButton = () => wrapper.find(GlButton);
const valueContainer = () => wrapper.find('.value'); const valueContainer = () => wrapper.find('.value');
const weightDropdown = () => wrapper.find(GlDropdown); const weightDropdown = () => wrapper.find(GlDropdown);
const getWeightItemAtIndex = index => weightDropdown().findAll(GlDropdownItem).at(index); const getWeightItemAtIndex = (index) => weightDropdown().findAll(GlDropdownItem).at(index);
const defaultProps = { const defaultProps = {
weights: ['Any', 'None', 0, 1, 2, 3], weights: ['Any', 'None', 0, 1, 2, 3],
board: { board: {
......
...@@ -33,7 +33,7 @@ const milestone2 = { ...@@ -33,7 +33,7 @@ const milestone2 = {
}; };
describe('Milestone select component', () => { describe('Milestone select component', () => {
beforeEach(done => { beforeEach((done) => {
setFixtures('<div class="test-container"></div>'); setFixtures('<div class="test-container"></div>');
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
...@@ -53,7 +53,7 @@ describe('Milestone select component', () => { ...@@ -53,7 +53,7 @@ describe('Milestone select component', () => {
}); });
describe('canEdit', () => { describe('canEdit', () => {
it('hides Edit button', done => { it('hides Edit button', (done) => {
vm.canEdit = false; vm.canEdit = false;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeFalsy(); expect(vm.$el.querySelector('.edit-link')).toBeFalsy();
...@@ -61,7 +61,7 @@ describe('Milestone select component', () => { ...@@ -61,7 +61,7 @@ describe('Milestone select component', () => {
}); });
}); });
it('shows Edit button if true', done => { it('shows Edit button if true', (done) => {
vm.canEdit = true; vm.canEdit = true;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('.edit-link')).toBeTruthy(); expect(vm.$el.querySelector('.edit-link')).toBeTruthy();
...@@ -75,7 +75,7 @@ describe('Milestone select component', () => { ...@@ -75,7 +75,7 @@ describe('Milestone select component', () => {
expect(selectedText()).toContain('Any milestone'); expect(selectedText()).toContain('Any milestone');
}); });
it('shows No milestone', done => { it('shows No milestone', (done) => {
vm.board.milestone_id = 0; vm.board.milestone_id = 0;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(selectedText()).toContain('No milestone'); expect(selectedText()).toContain('No milestone');
...@@ -83,7 +83,7 @@ describe('Milestone select component', () => { ...@@ -83,7 +83,7 @@ describe('Milestone select component', () => {
}); });
}); });
it('shows selected milestone title', done => { it('shows selected milestone title', (done) => {
vm.board.milestone_id = 20; vm.board.milestone_id = 20;
vm.board.milestone = { vm.board.milestone = {
id: 20, id: 20,
...@@ -100,7 +100,7 @@ describe('Milestone select component', () => { ...@@ -100,7 +100,7 @@ describe('Milestone select component', () => {
jest.spyOn(Api, 'projectMilestones').mockResolvedValue({ data: [milestone, milestone2] }); jest.spyOn(Api, 'projectMilestones').mockResolvedValue({ data: [milestone, milestone2] });
}); });
it('sets Any milestone', async done => { it('sets Any milestone', async (done) => {
vm.board.milestone_id = 0; vm.board.milestone_id = 0;
vm.$el.querySelector('.edit-link').click(); vm.$el.querySelector('.edit-link').click();
...@@ -118,7 +118,7 @@ describe('Milestone select component', () => { ...@@ -118,7 +118,7 @@ describe('Milestone select component', () => {
}); });
}); });
it('sets No milestone', done => { it('sets No milestone', (done) => {
vm.$el.querySelector('.edit-link').click(); vm.$el.querySelector('.edit-link').click();
jest.runOnlyPendingTimers(); jest.runOnlyPendingTimers();
...@@ -134,7 +134,7 @@ describe('Milestone select component', () => { ...@@ -134,7 +134,7 @@ describe('Milestone select component', () => {
}); });
}); });
it('sets milestone', done => { it('sets milestone', (done) => {
vm.$el.querySelector('.edit-link').click(); vm.$el.querySelector('.edit-link').click();
jest.runOnlyPendingTimers(); jest.runOnlyPendingTimers();
......
...@@ -36,7 +36,7 @@ export const mockLists = [ ...@@ -36,7 +36,7 @@ export const mockLists = [
}, },
]; ];
export const mockListsWithModel = mockLists.map(listMock => export const mockListsWithModel = mockLists.map((listMock) =>
Vue.observable(new List({ ...listMock, doNotFetchIssues: true })), Vue.observable(new List({ ...listMock, doNotFetchIssues: true })),
); );
......
...@@ -12,7 +12,7 @@ import * as commonUtils from '~/lib/utils/common_utils'; ...@@ -12,7 +12,7 @@ import * as commonUtils from '~/lib/utils/common_utils';
import { mergeUrlParams, removeParams } from '~/lib/utils/url_utility'; import { mergeUrlParams, removeParams } from '~/lib/utils/url_utility';
import { mockLists, mockIssue, mockIssue2, mockEpic, rawIssue } from '../mock_data'; import { mockLists, mockIssue, mockIssue2, mockEpic, rawIssue } from '../mock_data';
const expectNotImplemented = action => { const expectNotImplemented = (action) => {
it('is not implemented', () => { it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!')); expect(action).toThrow(new Error('Not implemented!'));
}); });
...@@ -101,7 +101,7 @@ describe('setFilters', () => { ...@@ -101,7 +101,7 @@ describe('setFilters', () => {
}); });
describe('performSearch', () => { describe('performSearch', () => {
it('should dispatch setFilters action', done => { it('should dispatch setFilters action', (done) => {
testAction(actions.performSearch, {}, {}, [], [{ type: 'setFilters', payload: {} }], done); testAction(actions.performSearch, {}, {}, [], [{ type: 'setFilters', payload: {} }], done);
}); });
...@@ -156,7 +156,7 @@ describe('fetchEpicsSwimlanes', () => { ...@@ -156,7 +156,7 @@ describe('fetchEpicsSwimlanes', () => {
}, },
}; };
it('should commit mutation RECEIVE_EPICS_SUCCESS on success without lists', done => { it('should commit mutation RECEIVE_EPICS_SUCCESS on success without lists', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction( testAction(
...@@ -174,7 +174,7 @@ describe('fetchEpicsSwimlanes', () => { ...@@ -174,7 +174,7 @@ describe('fetchEpicsSwimlanes', () => {
); );
}); });
it('should commit mutation RECEIVE_SWIMLANES_FAILURE on failure', done => { it('should commit mutation RECEIVE_SWIMLANES_FAILURE on failure', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject()); jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction( testAction(
...@@ -187,7 +187,7 @@ describe('fetchEpicsSwimlanes', () => { ...@@ -187,7 +187,7 @@ describe('fetchEpicsSwimlanes', () => {
); );
}); });
it('should dispatch fetchEpicsSwimlanes when page info hasNextPage', done => { it('should dispatch fetchEpicsSwimlanes when page info hasNextPage', (done) => {
const queryResponseWithNextPage = { const queryResponseWithNextPage = {
data: { data: {
group: { group: {
...@@ -240,7 +240,7 @@ describe('updateBoardEpicUserPreferences', () => { ...@@ -240,7 +240,7 @@ describe('updateBoardEpicUserPreferences', () => {
}, },
}); });
it('should send mutation', done => { it('should send mutation', (done) => {
const collapsed = true; const collapsed = true;
jest.spyOn(gqlClient, 'mutate').mockResolvedValue(queryResponse(collapsed)); jest.spyOn(gqlClient, 'mutate').mockResolvedValue(queryResponse(collapsed));
...@@ -266,7 +266,7 @@ describe('updateBoardEpicUserPreferences', () => { ...@@ -266,7 +266,7 @@ describe('updateBoardEpicUserPreferences', () => {
}); });
describe('setShowLabels', () => { describe('setShowLabels', () => {
it('should commit mutation SET_SHOW_LABELS', done => { it('should commit mutation SET_SHOW_LABELS', (done) => {
const state = { const state = {
isShowingLabels: true, isShowingLabels: true,
}; };
...@@ -417,7 +417,7 @@ describe('fetchIssuesForEpic', () => { ...@@ -417,7 +417,7 @@ describe('fetchIssuesForEpic', () => {
const formattedIssues = formatListIssues(queryResponse.data.group.board.lists); const formattedIssues = formatListIssues(queryResponse.data.group.board.lists);
it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', done => { it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction( testAction(
...@@ -433,7 +433,7 @@ describe('fetchIssuesForEpic', () => { ...@@ -433,7 +433,7 @@ describe('fetchIssuesForEpic', () => {
); );
}); });
it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', done => { it('should commit mutations REQUEST_ISSUES_FOR_EPIC and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject()); jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction( testAction(
...@@ -571,7 +571,7 @@ describe('setActiveIssueWeight', () => { ...@@ -571,7 +571,7 @@ describe('setActiveIssueWeight', () => {
projectPath: 'h/b', projectPath: 'h/b',
}; };
it('should commit weight after setting the issue', done => { it('should commit weight after setting the issue', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
issueSetWeight: { issueSetWeight: {
...@@ -636,7 +636,7 @@ describe('moveIssue', () => { ...@@ -636,7 +636,7 @@ describe('moveIssue', () => {
issues, issues,
}; };
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', done => { it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
issueMoveList: { issueMoveList: {
...@@ -677,7 +677,7 @@ describe('moveIssue', () => { ...@@ -677,7 +677,7 @@ describe('moveIssue', () => {
); );
}); });
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', done => { it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
issueMoveList: { issueMoveList: {
......
...@@ -99,7 +99,7 @@ describe('BoardsStoreEE', () => { ...@@ -99,7 +99,7 @@ describe('BoardsStoreEE', () => {
beforeEach(() => { beforeEach(() => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock.onPut(dummyEndpoint).replyOnce(config => requestSpy(config)); axiosMock.onPut(dummyEndpoint).replyOnce((config) => requestSpy(config));
}); });
it('makes a request to update the weight', () => { it('makes a request to update the weight', () => {
......
import mutations from 'ee/boards/stores/mutations'; import mutations from 'ee/boards/stores/mutations';
import { mockIssue, mockIssue2, mockEpics, mockEpic, mockLists } from '../mock_data'; import { mockIssue, mockIssue2, mockEpics, mockEpic, mockLists } from '../mock_data';
const expectNotImplemented = action => { const expectNotImplemented = (action) => {
it('is not implemented', () => { it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!')); expect(action).toThrow(new Error('Not implemented!'));
}); });
......
...@@ -24,7 +24,7 @@ describe('burndown_chart', () => { ...@@ -24,7 +24,7 @@ describe('burndown_chart', () => {
const findIssuesButton = () => wrapper.find({ ref: 'totalIssuesButton' }); const findIssuesButton = () => wrapper.find({ ref: 'totalIssuesButton' });
const findWeightButton = () => wrapper.find({ ref: 'totalWeightButton' }); const findWeightButton = () => wrapper.find({ ref: 'totalWeightButton' });
const findActiveButtons = () => const findActiveButtons = () =>
wrapper.findAll(GlButton).filter(button => button.attributes().category === 'primary'); wrapper.findAll(GlButton).filter((button) => button.attributes().category === 'primary');
const findBurndownChart = () => wrapper.find(BurndownChart); const findBurndownChart = () => wrapper.find(BurndownChart);
const findBurnupChart = () => wrapper.find(BurnupChart); const findBurnupChart = () => wrapper.find(BurnupChart);
const findOldBurndownChartButton = () => wrapper.find({ ref: 'oldBurndown' }); const findOldBurndownChartButton = () => wrapper.find({ ref: 'oldBurndown' });
......
...@@ -28,19 +28,19 @@ describe('Codequality report actions', () => { ...@@ -28,19 +28,19 @@ describe('Codequality report actions', () => {
}); });
describe('setPage', () => { describe('setPage', () => {
it('sets the page number', done => { it('sets the page number', (done) => {
testAction(actions.setPage, 12, state, [{ type: types.SET_PAGE, payload: 12 }], [], done); testAction(actions.setPage, 12, state, [{ type: types.SET_PAGE, payload: 12 }], [], done);
}); });
}); });
describe('requestReport', () => { describe('requestReport', () => {
it('sets the loading flag', done => { it('sets the loading flag', (done) => {
testAction(actions.requestReport, null, state, [{ type: types.REQUEST_REPORT }], [], done); testAction(actions.requestReport, null, state, [{ type: types.REQUEST_REPORT }], [], done);
}); });
}); });
describe('receiveReportSuccess', () => { describe('receiveReportSuccess', () => {
it('parses the list of issues from the report', done => { it('parses the list of issues from the report', (done) => {
testAction( testAction(
actions.receiveReportSuccess, actions.receiveReportSuccess,
unparsedIssues, unparsedIssues,
...@@ -53,7 +53,7 @@ describe('Codequality report actions', () => { ...@@ -53,7 +53,7 @@ describe('Codequality report actions', () => {
}); });
describe('receiveReportError', () => { describe('receiveReportError', () => {
it('accepts a report error', done => { it('accepts a report error', (done) => {
testAction( testAction(
actions.receiveReportError, actions.receiveReportError,
'error', 'error',
...@@ -70,7 +70,7 @@ describe('Codequality report actions', () => { ...@@ -70,7 +70,7 @@ describe('Codequality report actions', () => {
mock.onGet(endpoint).replyOnce(200, unparsedIssues); mock.onGet(endpoint).replyOnce(200, unparsedIssues);
}); });
it('fetches the report', done => { it('fetches the report', (done) => {
testAction( testAction(
actions.fetchReport, actions.fetchReport,
null, null,
...@@ -81,7 +81,7 @@ describe('Codequality report actions', () => { ...@@ -81,7 +81,7 @@ describe('Codequality report actions', () => {
); );
}); });
it('shows a flash message when there is an error', done => { it('shows a flash message when there is an error', (done) => {
testAction( testAction(
actions.fetchReport, actions.fetchReport,
'error', 'error',
...@@ -97,7 +97,7 @@ describe('Codequality report actions', () => { ...@@ -97,7 +97,7 @@ describe('Codequality report actions', () => {
); );
}); });
it('shows an error when blob path is missing', done => { it('shows an error when blob path is missing', (done) => {
testAction( testAction(
actions.fetchReport, actions.fetchReport,
null, null,
......
...@@ -8,7 +8,7 @@ const IMAGE_PATH = 'empty.svg'; ...@@ -8,7 +8,7 @@ const IMAGE_PATH = 'empty.svg';
describe('EmptyState component', () => { describe('EmptyState component', () => {
let wrapper; let wrapper;
const emptyStateProp = prop => wrapper.find(GlEmptyState).props(prop); const emptyStateProp = (prop) => wrapper.find(GlEmptyState).props(prop);
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
return shallowMount(EmptyState, { return shallowMount(EmptyState, {
......
...@@ -8,7 +8,7 @@ describe('BranchDetails component', () => { ...@@ -8,7 +8,7 @@ describe('BranchDetails component', () => {
// The truncate component adds left-to-right marks into the text that we have to remove // The truncate component adds left-to-right marks into the text that we have to remove
const getText = () => wrapper.text().replace(/\u200E/gi, ''); const getText = () => wrapper.text().replace(/\u200E/gi, '');
const linkExists = testId => wrapper.find(`[data-testid="${testId}"]`).exists(); const linkExists = (testId) => wrapper.find(`[data-testid="${testId}"]`).exists();
const createComponent = ({ sourceUri = '', targetUri = '' } = {}) => { const createComponent = ({ sourceUri = '', targetUri = '' } = {}) => {
return mount(BranchDetails, { return mount(BranchDetails, {
......
...@@ -53,7 +53,7 @@ describe('MergeRequestsGrid component', () => { ...@@ -53,7 +53,7 @@ describe('MergeRequestsGrid component', () => {
const mergeRequest = createMergeRequests({ count: 1 }); const mergeRequest = createMergeRequests({ count: 1 });
wrapper = createComponent(mergeRequest); wrapper = createComponent(mergeRequest);
findStatuses().wrappers.forEach(status => { findStatuses().wrappers.forEach((status) => {
const { type, data } = status.props('status'); const { type, data } = status.props('status');
switch (type) { switch (type) {
......
...@@ -9,7 +9,7 @@ describe('MergeRequest component', () => { ...@@ -9,7 +9,7 @@ describe('MergeRequest component', () => {
const findAuthorAvatarLink = () => wrapper.find('.issuable-authored').find(GlAvatarLink); const findAuthorAvatarLink = () => wrapper.find('.issuable-authored').find(GlAvatarLink);
const createComponent = mergeRequest => { const createComponent = (mergeRequest) => {
return shallowMount(MergeRequest, { return shallowMount(MergeRequest, {
propsData: { propsData: {
mergeRequest, mergeRequest,
......
...@@ -7,7 +7,7 @@ import Pipeline from 'ee/compliance_dashboard/components/merge_requests/statuses ...@@ -7,7 +7,7 @@ import Pipeline from 'ee/compliance_dashboard/components/merge_requests/statuses
describe('Status component', () => { describe('Status component', () => {
let wrapper; let wrapper;
const createComponent = status => { const createComponent = (status) => {
return shallowMount(Status, { return shallowMount(Status, {
propsData: { status }, propsData: { status },
}); });
...@@ -34,7 +34,7 @@ describe('Status component', () => { ...@@ -34,7 +34,7 @@ describe('Status component', () => {
${'approval'} | ${null} ${'approval'} | ${null}
${'approval'} | ${''} ${'approval'} | ${''}
${'pipeline'} | ${{}} ${'pipeline'} | ${{}}
`('does not render if given the status $value', status => { `('does not render if given the status $value', (status) => {
wrapper = createComponent(status); wrapper = createComponent(status);
checkStatusComponentExists(status, false); checkStatusComponentExists(status, false);
...@@ -44,7 +44,7 @@ describe('Status component', () => { ...@@ -44,7 +44,7 @@ describe('Status component', () => {
type | data type | data
${'approval'} | ${'success'} ${'approval'} | ${'success'}
${'pipeline'} | ${{ group: 'warning' }} ${'pipeline'} | ${{ group: 'warning' }}
`('renders if given the status $value', status => { `('renders if given the status $value', (status) => {
wrapper = createComponent(status); wrapper = createComponent(status);
checkStatusComponentExists(status, true); checkStatusComponentExists(status, true);
......
...@@ -9,7 +9,7 @@ describe('ApprovalStatus component', () => { ...@@ -9,7 +9,7 @@ describe('ApprovalStatus component', () => {
const findIcon = () => wrapper.find('.ci-icon'); const findIcon = () => wrapper.find('.ci-icon');
const findLink = () => wrapper.find(GlLink); const findLink = () => wrapper.find(GlLink);
const createComponent = status => { const createComponent = (status) => {
return shallowMount(Approval, { return shallowMount(Approval, {
propsData: { status }, propsData: { status },
stubs: { stubs: {
......
...@@ -10,7 +10,7 @@ describe('Pipeline component', () => { ...@@ -10,7 +10,7 @@ describe('Pipeline component', () => {
const findCiIcon = () => wrapper.find('.ci-icon'); const findCiIcon = () => wrapper.find('.ci-icon');
const findCiLink = () => wrapper.find(GlLink); const findCiLink = () => wrapper.find(GlLink);
const createComponent = status => { const createComponent = (status) => {
return shallowMount(Pipeline, { return shallowMount(Pipeline, {
propsData: { status }, propsData: { status },
stubs: { stubs: {
......
...@@ -5,7 +5,7 @@ import GridColumnHeading from 'ee/compliance_dashboard/components/shared/grid_co ...@@ -5,7 +5,7 @@ import GridColumnHeading from 'ee/compliance_dashboard/components/shared/grid_co
describe('GridColumnHeading component', () => { describe('GridColumnHeading component', () => {
let wrapper; let wrapper;
const createComponent = heading => { const createComponent = (heading) => {
return shallowMount(GridColumnHeading, { return shallowMount(GridColumnHeading, {
propsData: { heading }, propsData: { heading },
}); });
......
...@@ -7,7 +7,7 @@ describe('Pagination component', () => { ...@@ -7,7 +7,7 @@ describe('Pagination component', () => {
let wrapper; let wrapper;
const findGlPagination = () => wrapper.find(GlPagination); const findGlPagination = () => wrapper.find(GlPagination);
const getLink = query => wrapper.find(query).element.getAttribute('href'); const getLink = (query) => wrapper.find(query).element.getAttribute('href');
const findPrevPageLink = () => getLink('a.prev-page-item'); const findPrevPageLink = () => getLink('a.prev-page-item');
const findNextPageLink = () => getLink('a.next-page-item'); const findNextPageLink = () => getLink('a.next-page-item');
......
const createUser = id => ({ const createUser = (id) => ({
id, id,
avatar_url: `https://${id}`, avatar_url: `https://${id}`,
name: `User ${id}`, name: `User ${id}`,
...@@ -16,7 +16,7 @@ export const mergedAt = () => { ...@@ -16,7 +16,7 @@ export const mergedAt = () => {
return date.toISOString(); return date.toISOString();
}; };
export const createPipelineStatus = status => ({ export const createPipelineStatus = (status) => ({
details_path: '/h5bp/html5-boilerplate/pipelines/58', details_path: '/h5bp/html5-boilerplate/pipelines/58',
favicon: '', favicon: '',
group: status, group: status,
...@@ -45,7 +45,7 @@ export const createMergeRequest = ({ id = 1, props } = {}) => { ...@@ -45,7 +45,7 @@ export const createMergeRequest = ({ id = 1, props } = {}) => {
return { ...mergeRequest, ...props }; return { ...mergeRequest, ...props };
}; };
export const createApprovers = count => { export const createApprovers = (count) => {
return Array(count) return Array(count)
.fill(null) .fill(null)
.map((_, id) => createUser(id)); .map((_, id) => createUser(id));
......
...@@ -27,7 +27,7 @@ describe('DependenciesApp component', () => { ...@@ -27,7 +27,7 @@ describe('DependenciesApp component', () => {
store = createStore(); store = createStore();
jest.spyOn(store, 'dispatch').mockImplementation(); jest.spyOn(store, 'dispatch').mockImplementation();
const stubs = Object.keys(DependenciesApp.components).filter(name => name !== 'GlSprintf'); const stubs = Object.keys(DependenciesApp.components).filter((name) => name !== 'GlSprintf');
wrapper = mount(DependenciesApp, { wrapper = mount(DependenciesApp, {
store, store,
...@@ -107,7 +107,7 @@ describe('DependenciesApp component', () => { ...@@ -107,7 +107,7 @@ describe('DependenciesApp component', () => {
expect(componentWrapper.props()).toEqual(expect.objectContaining(props)); expect(componentWrapper.props()).toEqual(expect.objectContaining(props));
}; };
const expectComponentPropsToMatchSnapshot = Component => { const expectComponentPropsToMatchSnapshot = (Component) => {
const componentWrapper = wrapper.find(Component); const componentWrapper = wrapper.find(Component);
expect(componentWrapper.props()).toMatchSnapshot(); expect(componentWrapper.props()).toMatchSnapshot();
}; };
......
...@@ -41,7 +41,7 @@ describe('DependenciesActions component', () => { ...@@ -41,7 +41,7 @@ describe('DependenciesActions component', () => {
it('dispatches the right setSortField action on clicking each item in the dropdown', () => { it('dispatches the right setSortField action on clicking each item in the dropdown', () => {
const dropdownItems = wrapper.findAll(GlDropdownItem).wrappers; const dropdownItems = wrapper.findAll(GlDropdownItem).wrappers;
dropdownItems.forEach(item => { dropdownItems.forEach((item) => {
// trigger() does not work on stubbed/shallow mounted components // trigger() does not work on stubbed/shallow mounted components
// https://github.com/vuejs/vue-test-utils/issues/919 // https://github.com/vuejs/vue-test-utils/issues/919
item.vm.$emit('click'); item.vm.$emit('click');
...@@ -49,7 +49,7 @@ describe('DependenciesActions component', () => { ...@@ -49,7 +49,7 @@ describe('DependenciesActions component', () => {
expect(store.dispatch.mock.calls).toEqual( expect(store.dispatch.mock.calls).toEqual(
expect.arrayContaining( expect.arrayContaining(
Object.keys(SORT_FIELDS).map(field => [`${namespace}/setSortField`, field]), Object.keys(SORT_FIELDS).map((field) => [`${namespace}/setSortField`, field]),
), ),
); );
}); });
......
...@@ -5,7 +5,7 @@ import DependenciesLicenseLinks from 'ee/dependencies/components/dependency_lice ...@@ -5,7 +5,7 @@ import DependenciesLicenseLinks from 'ee/dependencies/components/dependency_lice
describe('DependencyLicenseLinks component', () => { describe('DependencyLicenseLinks component', () => {
// data helpers // data helpers
const createLicenses = n => [...Array(n).keys()].map(i => ({ name: `license ${i + 1}` })); const createLicenses = (n) => [...Array(n).keys()].map((i) => ({ name: `license ${i + 1}` }));
const addUrls = (licenses, numLicensesWithUrls = Infinity) => const addUrls = (licenses, numLicensesWithUrls = Infinity) =>
licenses.map((ls, i) => ({ licenses.map((ls, i) => ({
...ls, ...ls,
...@@ -26,7 +26,7 @@ describe('DependencyLicenseLinks component', () => { ...@@ -26,7 +26,7 @@ describe('DependencyLicenseLinks component', () => {
}; };
// query helpers // query helpers
const jsTestClassSelector = name => `.js-license-links-${name}`; const jsTestClassSelector = (name) => `.js-license-links-${name}`;
const findLicensesList = () => wrapper.find(jsTestClassSelector('license-list')); const findLicensesList = () => wrapper.find(jsTestClassSelector('license-list'));
const findLicenseListItems = () => wrapper.findAll(jsTestClassSelector('license-list-item')); const findLicenseListItems = () => wrapper.findAll(jsTestClassSelector('license-list-item'));
const findModal = () => wrapper.find(jsTestClassSelector('modal')); const findModal = () => wrapper.find(jsTestClassSelector('modal'));
...@@ -46,7 +46,7 @@ describe('DependencyLicenseLinks component', () => { ...@@ -46,7 +46,7 @@ describe('DependencyLicenseLinks component', () => {
expect(intersperseInstance.attributes('lastseparator')).toBe(' and '); expect(intersperseInstance.attributes('lastseparator')).toBe(' and ');
}); });
it.each([3, 5, 8, 13])('limits the number of visible licenses to 2', numLicenses => { it.each([3, 5, 8, 13])('limits the number of visible licenses to 2', (numLicenses) => {
factory({ numLicenses }); factory({ numLicenses });
expect(findLicenseListItems()).toHaveLength(2); expect(findLicenseListItems()).toHaveLength(2);
...@@ -76,7 +76,7 @@ describe('DependencyLicenseLinks component', () => { ...@@ -76,7 +76,7 @@ describe('DependencyLicenseLinks component', () => {
const links = wrapper.findAll(GlLink); const links = wrapper.findAll(GlLink);
links.wrappers.forEach(link => { links.wrappers.forEach((link) => {
expect(link.attributes('target')).toBe('_blank'); expect(link.attributes('target')).toBe('_blank');
}); });
}); });
......
...@@ -43,7 +43,7 @@ describe('DependencyListJobFailedAlert component', () => { ...@@ -43,7 +43,7 @@ describe('DependencyListJobFailedAlert component', () => {
it.each([undefined, null, ''])( it.each([undefined, null, ''])(
'does not include a button if "jobPath" is given but empty', 'does not include a button if "jobPath" is given but empty',
jobPath => { (jobPath) => {
factory({ propsData: { jobPath } }); factory({ propsData: { jobPath } });
expect(wrapper.find(GlAlert).props()).toMatchObject(NO_BUTTON_PROPS); expect(wrapper.find(GlAlert).props()).toMatchObject(NO_BUTTON_PROPS);
......
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