Commit 7f4e951c authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 45 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 7dae714f
...@@ -1369,39 +1369,6 @@ ee/app/assets/javascripts/vulnerabilities/components/resolution_alert.vue ...@@ -1369,39 +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
## inspiring-banach
ee/spec/frontend/analytics/productivity_analytics/components/app_spec.js
ee/spec/frontend/analytics/productivity_analytics/helpers.js
ee/spec/frontend/analytics/productivity_analytics/store/actions_spec.js
ee/spec/frontend/analytics/productivity_analytics/store/modules/charts/actions_spec.js
ee/spec/frontend/analytics/productivity_analytics/store/modules/charts/getters_spec.js
ee/spec/frontend/analytics/productivity_analytics/store/modules/filters/actions_spec.js
ee/spec/frontend/analytics/productivity_analytics/store/modules/table/actions_spec.js
ee/spec/frontend/analytics/repository_analytics/components/select_projects_dropdown_spec.js
ee/spec/frontend/analytics/repository_analytics/components/test_coverage_table_spec.js
ee/spec/frontend/analytics/shared/utils_spec.js
ee/spec/frontend/api_spec.js
ee/spec/frontend/approvals/components/approval_check_popover_spec.js
ee/spec/frontend/approvals/components/approval_check_rule_popover_spec.js
ee/spec/frontend/approvals/components/approvers_select_spec.js
ee/spec/frontend/approvals/components/branches_select_spec.js
ee/spec/frontend/approvals/components/license_compliance/index_spec.js
ee/spec/frontend/approvals/components/license_compliance/modal_spec.js
ee/spec/frontend/approvals/components/mr_edit/mr_rules_hidden_inputs_spec.js
ee/spec/frontend/approvals/components/mr_edit/mr_rules_spec.js
ee/spec/frontend/approvals/components/project_settings/project_rules_spec.js
ee/spec/frontend/approvals/components/rule_form_spec.js
ee/spec/frontend/approvals/stores/modules/mr_edit/actions_spec.js
ee/spec/frontend/approvals/stores/modules/project_settings/actions_spec.js
ee/spec/frontend/audit_events/components/audit_events_app_spec.js
ee/spec/frontend/audit_events/components/sorting_field_spec.js
ee/spec/frontend/audit_events/components/tokens/audit_filter_token_spec.js
ee/spec/frontend/billings/helpers.js
ee/spec/frontend/billings/seat_usage/components/subscription_seats_spec.js
ee/spec/frontend/billings/seat_usage/store/actions_spec.js
ee/spec/frontend/billings/subscriptions/components/subscription_table_row_spec.js
ee/spec/frontend/billings/subscriptions/store/mutations_spec.js
## keen-napier ## keen-napier
ee/spec/frontend/boards/components/assignee_select_spec.js 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_new_spec.js
......
...@@ -570,7 +570,7 @@ describe('ProductivityApp component', () => { ...@@ -570,7 +570,7 @@ describe('ProductivityApp component', () => {
milestone_title: null, milestone_title: null,
}; };
const shouldSetUrlParams = result => { const shouldSetUrlParams = (result) => {
expect(urlUtils.setUrlParams).toHaveBeenCalledWith(result, window.location.href, true); expect(urlUtils.setUrlParams).toHaveBeenCalledWith(result, window.location.href, true);
expect(commonUtils.historyPushState).toHaveBeenCalled(); expect(commonUtils.historyPushState).toHaveBeenCalled();
}; };
......
...@@ -3,7 +3,7 @@ import filterState from 'ee/analytics/productivity_analytics/store/modules/filte ...@@ -3,7 +3,7 @@ import filterState from 'ee/analytics/productivity_analytics/store/modules/filte
import tableState from 'ee/analytics/productivity_analytics/store/modules/table/state'; import tableState from 'ee/analytics/productivity_analytics/store/modules/table/state';
import state from 'ee/analytics/productivity_analytics/store/state'; import state from 'ee/analytics/productivity_analytics/store/state';
const resetStore = store => { const resetStore = (store) => {
const newState = { const newState = {
...state(), ...state(),
filters: filterState(), filters: filterState(),
......
...@@ -5,7 +5,7 @@ import testAction from 'helpers/vuex_action_helper'; ...@@ -5,7 +5,7 @@ import testAction from 'helpers/vuex_action_helper';
describe('Productivity analytics actions', () => { describe('Productivity analytics actions', () => {
describe('setEndpoint', () => { describe('setEndpoint', () => {
it('commits the SET_ENDPOINT mutation', done => it('commits the SET_ENDPOINT mutation', (done) =>
testAction( testAction(
actions.setEndpoint, actions.setEndpoint,
'endpoint.json', 'endpoint.json',
......
...@@ -72,7 +72,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -72,7 +72,7 @@ describe('Productivity analytics chart actions', () => {
expect(axios.get).toHaveBeenCalledWith(mockedState.endpoint, { params: globalParams }); expect(axios.get).toHaveBeenCalledWith(mockedState.endpoint, { params: globalParams });
}); });
it('dispatches success with received data', done => it('dispatches success with received data', (done) =>
testAction( testAction(
actions.fetchChartData, actions.fetchChartData,
chartKey, chartKey,
...@@ -94,7 +94,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -94,7 +94,7 @@ describe('Productivity analytics chart actions', () => {
mock.onGet(mockedState.endpoint).replyOnce(200, mockScatterplotData); mock.onGet(mockedState.endpoint).replyOnce(200, mockScatterplotData);
}); });
it('dispatches success with received data and transformedData', done => { it('dispatches success with received data and transformedData', (done) => {
testAction( testAction(
actions.fetchChartData, actions.fetchChartData,
chartKeys.scatterplot, chartKeys.scatterplot,
...@@ -122,7 +122,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -122,7 +122,7 @@ describe('Productivity analytics chart actions', () => {
mock.onGet(mockedState.endpoint).replyOnce(500); mock.onGet(mockedState.endpoint).replyOnce(500);
}); });
it('dispatches error', done => { it('dispatches error', (done) => {
testAction( testAction(
actions.fetchChartData, actions.fetchChartData,
chartKey, chartKey,
...@@ -149,7 +149,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -149,7 +149,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('requestChartData', () => { describe('requestChartData', () => {
it('should commit the request mutation', done => { it('should commit the request mutation', (done) => {
testAction( testAction(
actions.requestChartData, actions.requestChartData,
chartKey, chartKey,
...@@ -167,7 +167,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -167,7 +167,7 @@ describe('Productivity analytics chart actions', () => {
mockedState.charts[disabledChartKey].enabled = false; mockedState.charts[disabledChartKey].enabled = false;
}); });
it('does not dispatch the requestChartData action', done => { it('does not dispatch the requestChartData action', (done) => {
testAction(actions.fetchChartData, disabledChartKey, mockedState, [], [], done); testAction(actions.fetchChartData, disabledChartKey, mockedState, [], [], done);
}); });
...@@ -180,7 +180,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -180,7 +180,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('receiveChartDataSuccess', () => { describe('receiveChartDataSuccess', () => {
it('should commit received data', done => { it('should commit received data', (done) => {
testAction( testAction(
actions.receiveChartDataSuccess, actions.receiveChartDataSuccess,
{ chartKey, data: mockHistogramData }, { chartKey, data: mockHistogramData },
...@@ -198,7 +198,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -198,7 +198,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('receiveChartDataError', () => { describe('receiveChartDataError', () => {
it('should commit error', done => { it('should commit error', (done) => {
const error = { response: { status: 500 } }; const error = { response: { status: 500 } };
testAction( testAction(
actions.receiveChartDataError, actions.receiveChartDataError,
...@@ -220,7 +220,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -220,7 +220,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('fetchSecondaryChartData', () => { describe('fetchSecondaryChartData', () => {
it('dispatches fetchChartData for all chart types except for the main chart', done => { it('dispatches fetchChartData for all chart types except for the main chart', (done) => {
testAction( testAction(
actions.fetchSecondaryChartData, actions.fetchSecondaryChartData,
null, null,
...@@ -239,7 +239,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -239,7 +239,7 @@ describe('Productivity analytics chart actions', () => {
describe('setMetricType', () => { describe('setMetricType', () => {
const metricType = 'time_to_merge'; const metricType = 'time_to_merge';
it('should commit metricType', done => { it('should commit metricType', (done) => {
testAction( testAction(
actions.setMetricType, actions.setMetricType,
{ chartKey, metricType }, { chartKey, metricType },
...@@ -252,7 +252,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -252,7 +252,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('updateSelectedItems', () => { describe('updateSelectedItems', () => {
it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', done => { it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', (done) => {
testAction( testAction(
actions.updateSelectedItems, actions.updateSelectedItems,
{ chartKey, item: 5 }, { chartKey, item: 5 },
...@@ -266,7 +266,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -266,7 +266,7 @@ describe('Productivity analytics chart actions', () => {
describe('resetMainChartSelection', () => { describe('resetMainChartSelection', () => {
describe('when skipReload is false (by default)', () => { describe('when skipReload is false (by default)', () => {
it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', done => { it('should commit selected chart item and dispatch fetchSecondaryChartData and setPage', (done) => {
testAction( testAction(
actions.resetMainChartSelection, actions.resetMainChartSelection,
null, null,
...@@ -279,7 +279,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -279,7 +279,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('when skipReload is true', () => { describe('when skipReload is true', () => {
it('should commit selected chart and it should not dispatch any further actions', done => { it('should commit selected chart and it should not dispatch any further actions', (done) => {
testAction( testAction(
actions.resetMainChartSelection, actions.resetMainChartSelection,
true, true,
...@@ -298,7 +298,7 @@ describe('Productivity analytics chart actions', () => { ...@@ -298,7 +298,7 @@ describe('Productivity analytics chart actions', () => {
}); });
describe('setChartEnabled', () => { describe('setChartEnabled', () => {
it('should commit enabled state', done => { it('should commit enabled state', (done) => {
testAction( testAction(
actions.setChartEnabled, actions.setChartEnabled,
{ chartKey: chartKeys.scatterplot, isEnabled: false }, { chartKey: chartKeys.scatterplot, isEnabled: false },
......
...@@ -255,7 +255,7 @@ describe('Productivity analytics chart getters', () => { ...@@ -255,7 +255,7 @@ describe('Productivity analytics chart getters', () => {
expect(getters.scatterplotYaxisLabel(null, mockGetters, mockRootState)).toBe('Days'); expect(getters.scatterplotYaxisLabel(null, mockGetters, mockRootState)).toBe('Days');
}); });
it.each(metricsInHours)('returns "Hours" for the "%s" metric', metric => { it.each(metricsInHours)('returns "Hours" for the "%s" metric', (metric) => {
const mockGetters = { const mockGetters = {
getSelectedMetric: () => metric, getSelectedMetric: () => metric,
}; };
......
...@@ -30,7 +30,7 @@ describe('Productivity analytics filter actions', () => { ...@@ -30,7 +30,7 @@ describe('Productivity analytics filter actions', () => {
}); });
describe('setInitialData', () => { describe('setInitialData', () => {
it('commits the SET_INITIAL_DATA mutation and fetches data by default', done => { it('commits the SET_INITIAL_DATA mutation and fetches data by default', (done) => {
actions actions
.setInitialData(store, { data: initialData }) .setInitialData(store, { data: initialData })
.then(() => { .then(() => {
...@@ -54,7 +54,7 @@ describe('Productivity analytics filter actions', () => { ...@@ -54,7 +54,7 @@ describe('Productivity analytics filter actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it("commits the SET_INITIAL_DATA mutation and doesn't fetch data when skipFetch=true", done => it("commits the SET_INITIAL_DATA mutation and doesn't fetch data when skipFetch=true", (done) =>
testAction( testAction(
actions.setInitialData, actions.setInitialData,
{ skipFetch: true, data: initialData }, { skipFetch: true, data: initialData },
...@@ -71,7 +71,7 @@ describe('Productivity analytics filter actions', () => { ...@@ -71,7 +71,7 @@ describe('Productivity analytics filter actions', () => {
}); });
describe('setGroupNamespace', () => { describe('setGroupNamespace', () => {
it('commits the SET_GROUP_NAMESPACE mutation', done => { it('commits the SET_GROUP_NAMESPACE mutation', (done) => {
actions actions
.setGroupNamespace(store, groupNamespace) .setGroupNamespace(store, groupNamespace)
.then(() => { .then(() => {
...@@ -103,7 +103,7 @@ describe('Productivity analytics filter actions', () => { ...@@ -103,7 +103,7 @@ describe('Productivity analytics filter actions', () => {
}); });
describe('setProjectPath', () => { describe('setProjectPath', () => {
it('commits the SET_PROJECT_PATH mutation', done => { it('commits the SET_PROJECT_PATH mutation', (done) => {
actions actions
.setProjectPath(store, projectPath) .setProjectPath(store, projectPath)
.then(() => { .then(() => {
...@@ -135,7 +135,7 @@ describe('Productivity analytics filter actions', () => { ...@@ -135,7 +135,7 @@ describe('Productivity analytics filter actions', () => {
}); });
describe('setFilters', () => { describe('setFilters', () => {
it('commits the SET_FILTERS mutation', done => { it('commits the SET_FILTERS mutation', (done) => {
actions actions
.setFilters(store, { author_username: 'root' }) .setFilters(store, { author_username: 'root' })
.then(() => { .then(() => {
...@@ -167,7 +167,7 @@ describe('Productivity analytics filter actions', () => { ...@@ -167,7 +167,7 @@ describe('Productivity analytics filter actions', () => {
}); });
describe('setDateRange', () => { describe('setDateRange', () => {
it('commits the SET_DATE_RANGE mutation', done => { it('commits the SET_DATE_RANGE mutation', (done) => {
actions actions
.setDateRange(store, { startDate, endDate }) .setDateRange(store, { startDate, endDate })
.then(() => { .then(() => {
......
...@@ -104,7 +104,7 @@ describe('Productivity analytics table actions', () => { ...@@ -104,7 +104,7 @@ describe('Productivity analytics table actions', () => {
}); });
}); });
it('dispatches success with received data', done => it('dispatches success with received data', (done) =>
testAction( testAction(
actions.fetchMergeRequests, actions.fetchMergeRequests,
null, null,
...@@ -126,7 +126,7 @@ describe('Productivity analytics table actions', () => { ...@@ -126,7 +126,7 @@ describe('Productivity analytics table actions', () => {
mock.onGet(mockedState.endpoint).replyOnce(500); mock.onGet(mockedState.endpoint).replyOnce(500);
}); });
it('dispatches error', done => { it('dispatches error', (done) => {
testAction( testAction(
actions.fetchMergeRequests, actions.fetchMergeRequests,
null, null,
...@@ -146,7 +146,7 @@ describe('Productivity analytics table actions', () => { ...@@ -146,7 +146,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('requestMergeRequests', () => { describe('requestMergeRequests', () => {
it('should commit the request mutation', done => it('should commit the request mutation', (done) =>
testAction( testAction(
actions.requestMergeRequests, actions.requestMergeRequests,
null, null,
...@@ -158,7 +158,7 @@ describe('Productivity analytics table actions', () => { ...@@ -158,7 +158,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('receiveMergeRequestsSuccess', () => { describe('receiveMergeRequestsSuccess', () => {
it('should commit received data', done => it('should commit received data', (done) =>
testAction( testAction(
actions.receiveMergeRequestsSuccess, actions.receiveMergeRequestsSuccess,
{ headers, data: mockMergeRequests }, { headers, data: mockMergeRequests },
...@@ -175,7 +175,7 @@ describe('Productivity analytics table actions', () => { ...@@ -175,7 +175,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('receiveMergeRequestsError', () => { describe('receiveMergeRequestsError', () => {
it('should commit error', done => it('should commit error', (done) =>
testAction( testAction(
actions.receiveMergeRequestsError, actions.receiveMergeRequestsError,
{ response: { status: 500 } }, { response: { status: 500 } },
...@@ -187,7 +187,7 @@ describe('Productivity analytics table actions', () => { ...@@ -187,7 +187,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('setSortField', () => { describe('setSortField', () => {
it('should commit setSortField', done => it('should commit setSortField', (done) =>
testAction( testAction(
actions.setSortField, actions.setSortField,
'time_to_last_commit', 'time_to_last_commit',
...@@ -200,7 +200,7 @@ describe('Productivity analytics table actions', () => { ...@@ -200,7 +200,7 @@ describe('Productivity analytics table actions', () => {
done, done,
)); ));
it('should not dispatch setColumnMetric when metric is "days_to_merge"', done => it('should not dispatch setColumnMetric when metric is "days_to_merge"', (done) =>
testAction( testAction(
actions.setSortField, actions.setSortField,
'days_to_merge', 'days_to_merge',
...@@ -212,7 +212,7 @@ describe('Productivity analytics table actions', () => { ...@@ -212,7 +212,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('toggleSortOrder', () => { describe('toggleSortOrder', () => {
it('should commit toggleSortOrder', done => it('should commit toggleSortOrder', (done) =>
testAction( testAction(
actions.toggleSortOrder, actions.toggleSortOrder,
null, null,
...@@ -224,7 +224,7 @@ describe('Productivity analytics table actions', () => { ...@@ -224,7 +224,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('setColumnMetric', () => { describe('setColumnMetric', () => {
it('should commit setColumnMetric', done => it('should commit setColumnMetric', (done) =>
testAction( testAction(
actions.setColumnMetric, actions.setColumnMetric,
'time_to_first_comment', 'time_to_first_comment',
...@@ -236,7 +236,7 @@ describe('Productivity analytics table actions', () => { ...@@ -236,7 +236,7 @@ describe('Productivity analytics table actions', () => {
}); });
describe('setPage', () => { describe('setPage', () => {
it('should commit setPage', done => it('should commit setPage', (done) =>
testAction( testAction(
actions.setPage, actions.setPage,
2, 2,
......
...@@ -14,9 +14,9 @@ describe('Select projects dropdown component', () => { ...@@ -14,9 +14,9 @@ describe('Select projects dropdown component', () => {
let wrapper; let wrapper;
const findSelectAllProjects = () => wrapper.find('[data-testid="select-all-projects"]'); const findSelectAllProjects = () => wrapper.find('[data-testid="select-all-projects"]');
const findProjectById = id => wrapper.find(`[data-testid="select-project-${id}"]`); const findProjectById = (id) => wrapper.find(`[data-testid="select-project-${id}"]`);
const selectAllProjects = () => findSelectAllProjects().trigger('click'); const selectAllProjects = () => findSelectAllProjects().trigger('click');
const selectProjectById = id => findProjectById(id).trigger('click'); const selectProjectById = (id) => findProjectById(id).trigger('click');
const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver); const findIntersectionObserver = () => wrapper.find(GlIntersectionObserver);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
......
...@@ -18,10 +18,10 @@ describe('Test coverage table component', () => { ...@@ -18,10 +18,10 @@ describe('Test coverage table component', () => {
const findLoadingState = () => wrapper.find('[data-testid="test-coverage-loading-state"'); const findLoadingState = () => wrapper.find('[data-testid="test-coverage-loading-state"');
const findTable = () => wrapper.find('[data-testid="test-coverage-data-table"'); const findTable = () => wrapper.find('[data-testid="test-coverage-data-table"');
const findTableRows = () => findTable().findAll('tbody tr'); const findTableRows = () => findTable().findAll('tbody tr');
const findProjectNameById = id => wrapper.find(`[data-testid="${id}-name"`); const findProjectNameById = (id) => wrapper.find(`[data-testid="${id}-name"`);
const findProjectAverageById = id => wrapper.find(`[data-testid="${id}-average"`); const findProjectAverageById = (id) => wrapper.find(`[data-testid="${id}-average"`);
const findProjectCountById = id => wrapper.find(`[data-testid="${id}-count"`); const findProjectCountById = (id) => wrapper.find(`[data-testid="${id}-count"`);
const findProjectDateById = id => wrapper.find(`[data-testid="${id}-date"`); const findProjectDateById = (id) => wrapper.find(`[data-testid="${id}-date"`);
const createComponent = ({ data = {}, mountFn = shallowMount } = {}) => { const createComponent = ({ data = {}, mountFn = shallowMount } = {}) => {
wrapper = mountFn(TestCoverageTable, { wrapper = mountFn(TestCoverageTable, {
......
...@@ -192,7 +192,7 @@ describe('buildCycleAnalyticsInitialData', () => { ...@@ -192,7 +192,7 @@ describe('buildCycleAnalyticsInitialData', () => {
}); });
it('with no search term returns the data', () => { it('with no search term returns the data', () => {
['', null].forEach(search => { ['', null].forEach((search) => {
expect(filterBySearchTerm(data, search)).toEqual(data); expect(filterBySearchTerm(data, search)).toEqual(data);
}); });
}); });
......
...@@ -42,7 +42,7 @@ describe('Api', () => { ...@@ -42,7 +42,7 @@ describe('Api', () => {
}); });
describe('ldapGroups', () => { describe('ldapGroups', () => {
it('calls callback on completion', done => { it('calls callback on completion', (done) => {
const query = 'query'; const query = 'query';
const provider = 'provider'; const provider = 'provider';
const callback = jest.fn(); const callback = jest.fn();
...@@ -55,7 +55,7 @@ describe('Api', () => { ...@@ -55,7 +55,7 @@ describe('Api', () => {
]); ]);
Api.ldapGroups(query, provider, callback) Api.ldapGroups(query, provider, callback)
.then(response => { .then((response) => {
expect(callback).toHaveBeenCalledWith(response); expect(callback).toHaveBeenCalledWith(response);
}) })
.then(done) .then(done)
...@@ -64,7 +64,7 @@ describe('Api', () => { ...@@ -64,7 +64,7 @@ describe('Api', () => {
}); });
describe('createChildEpic', () => { describe('createChildEpic', () => {
it('calls `axios.post` using params `groupId`, `parentEpicIid` and title', done => { it('calls `axios.post` using params `groupId`, `parentEpicIid` and title', (done) => {
const groupId = 'gitlab-org'; const groupId = 'gitlab-org';
const parentEpicId = 1; const parentEpicId = 1;
const title = 'Sample epic'; const title = 'Sample epic';
...@@ -89,7 +89,7 @@ describe('Api', () => { ...@@ -89,7 +89,7 @@ describe('Api', () => {
}); });
describe('groupEpics', () => { describe('groupEpics', () => {
it('calls `axios.get` using param `groupId`', done => { it('calls `axios.get` using param `groupId`', (done) => {
const groupId = 2; const groupId = 2;
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/epics`; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/epics`;
...@@ -115,7 +115,7 @@ describe('Api', () => { ...@@ -115,7 +115,7 @@ describe('Api', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls `axios.get` using param `search` when it is provided', done => { it('calls `axios.get` using param `search` when it is provided', (done) => {
const groupId = 2; const groupId = 2;
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/epics`; const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/epics`;
...@@ -144,7 +144,7 @@ describe('Api', () => { ...@@ -144,7 +144,7 @@ describe('Api', () => {
}); });
describe('addEpicIssue', () => { describe('addEpicIssue', () => {
it('calls `axios.post` using params `groupId`, `epicIid` and `issueId`', done => { it('calls `axios.post` using params `groupId`, `epicIid` and `issueId`', (done) => {
const groupId = 2; const groupId = 2;
const mockIssue = { const mockIssue = {
id: 20, id: 20,
...@@ -170,7 +170,7 @@ describe('Api', () => { ...@@ -170,7 +170,7 @@ describe('Api', () => {
}); });
describe('removeEpicIssue', () => { describe('removeEpicIssue', () => {
it('calls `axios.delete` using params `groupId`, `epicIid` and `epicIssueId`', done => { it('calls `axios.delete` using params `groupId`, `epicIid` and `epicIssueId`', (done) => {
const groupId = 2; const groupId = 2;
const mockIssue = { const mockIssue = {
id: 20, id: 20,
...@@ -227,7 +227,7 @@ describe('Api', () => { ...@@ -227,7 +227,7 @@ describe('Api', () => {
}; };
describe('cycleAnalyticsTasksByType', () => { describe('cycleAnalyticsTasksByType', () => {
it('fetches tasks by type data', done => { it('fetches tasks by type data', (done) => {
const tasksByTypeResponse = [ const tasksByTypeResponse = [
{ {
label: { label: {
...@@ -266,7 +266,7 @@ describe('Api', () => { ...@@ -266,7 +266,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsTopLabels', () => { describe('cycleAnalyticsTopLabels', () => {
it('fetches top group level labels', done => { it('fetches top group level labels', (done) => {
const response = []; const response = [];
const labelIds = [10, 9, 8, 7]; const labelIds = [10, 9, 8, 7];
const params = { const params = {
...@@ -291,7 +291,7 @@ describe('Api', () => { ...@@ -291,7 +291,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsSummaryData', () => { describe('cycleAnalyticsSummaryData', () => {
it('fetches value stream analytics summary data', done => { it('fetches value stream analytics summary data', (done) => {
const response = [ const response = [
{ value: 0, title: 'New Issues' }, { value: 0, title: 'New Issues' },
{ value: 0, title: 'Deploys' }, { value: 0, title: 'Deploys' },
...@@ -301,7 +301,7 @@ describe('Api', () => { ...@@ -301,7 +301,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsSummaryData(groupId, params) Api.cycleAnalyticsSummaryData(groupId, params)
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
params, params,
...@@ -314,7 +314,7 @@ describe('Api', () => { ...@@ -314,7 +314,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsTimeSummaryData', () => { describe('cycleAnalyticsTimeSummaryData', () => {
it('fetches value stream analytics summary data', done => { it('fetches value stream analytics summary data', (done) => {
const response = [ const response = [
{ value: '10.0', title: 'Lead time', unit: 'per day' }, { value: '10.0', title: 'Lead time', unit: 'per day' },
{ value: '2.0', title: 'Cycle Time', unit: 'per day' }, { value: '2.0', title: 'Cycle Time', unit: 'per day' },
...@@ -325,7 +325,7 @@ describe('Api', () => { ...@@ -325,7 +325,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsTimeSummaryData(groupId, params) Api.cycleAnalyticsTimeSummaryData(groupId, params)
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
params, params,
...@@ -338,13 +338,13 @@ describe('Api', () => { ...@@ -338,13 +338,13 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsValueStreams', () => { describe('cycleAnalyticsValueStreams', () => {
it('fetches custom value streams', done => { it('fetches custom value streams', (done) => {
const response = [{ name: 'value stream 1', id: 1 }]; const response = [{ name: 'value stream 1', id: 1 }];
const expectedUrl = valueStreamBaseUrl({ resource: 'value_streams' }); const expectedUrl = valueStreamBaseUrl({ resource: 'value_streams' });
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsValueStreams(groupId) Api.cycleAnalyticsValueStreams(groupId)
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
expectedUrl, expectedUrl,
...@@ -356,7 +356,7 @@ describe('Api', () => { ...@@ -356,7 +356,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsCreateValueStream', () => { describe('cycleAnalyticsCreateValueStream', () => {
it('submit the custom value stream data', done => { it('submit the custom value stream data', (done) => {
const response = {}; const response = {};
const customValueStream = { name: 'cool-value-stream-stage' }; const customValueStream = { name: 'cool-value-stream-stage' };
const expectedUrl = valueStreamBaseUrl({ resource: 'value_streams' }); const expectedUrl = valueStreamBaseUrl({ resource: 'value_streams' });
...@@ -374,7 +374,7 @@ describe('Api', () => { ...@@ -374,7 +374,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsDeleteValueStream', () => { describe('cycleAnalyticsDeleteValueStream', () => {
it('delete the custom value stream', done => { it('delete the custom value stream', (done) => {
const response = {}; const response = {};
const expectedUrl = valueStreamBaseUrl({ resource: `value_streams/${valueStreamId}` }); const expectedUrl = valueStreamBaseUrl({ resource: `value_streams/${valueStreamId}` });
mock.onDelete(expectedUrl).reply(httpStatus.OK, response); mock.onDelete(expectedUrl).reply(httpStatus.OK, response);
...@@ -390,7 +390,7 @@ describe('Api', () => { ...@@ -390,7 +390,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsGroupStagesAndEvents', () => { describe('cycleAnalyticsGroupStagesAndEvents', () => {
it('fetches custom stage events and all stages', done => { it('fetches custom stage events and all stages', (done) => {
const response = { events: [], stages: [] }; const response = { events: [], stages: [] };
const params = { const params = {
group_id: groupId, group_id: groupId,
...@@ -401,7 +401,7 @@ describe('Api', () => { ...@@ -401,7 +401,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsGroupStagesAndEvents({ groupId, valueStreamId, params }) Api.cycleAnalyticsGroupStagesAndEvents({ groupId, valueStreamId, params })
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
params, params,
...@@ -414,7 +414,7 @@ describe('Api', () => { ...@@ -414,7 +414,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsStageEvents', () => { describe('cycleAnalyticsStageEvents', () => {
it('fetches stage events', done => { it('fetches stage events', (done) => {
const response = { events: [] }; const response = { events: [] };
const params = { ...defaultParams }; const params = { ...defaultParams };
const expectedUrl = valueStreamBaseUrl({ const expectedUrl = valueStreamBaseUrl({
...@@ -424,7 +424,7 @@ describe('Api', () => { ...@@ -424,7 +424,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsStageEvents({ groupId, valueStreamId, stageId, params }) Api.cycleAnalyticsStageEvents({ groupId, valueStreamId, stageId, params })
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
params, params,
...@@ -437,7 +437,7 @@ describe('Api', () => { ...@@ -437,7 +437,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsStageMedian', () => { describe('cycleAnalyticsStageMedian', () => {
it('fetches stage events', done => { it('fetches stage events', (done) => {
const response = { value: '5 days ago' }; const response = { value: '5 days ago' };
const params = { ...defaultParams }; const params = { ...defaultParams };
const expectedUrl = valueStreamBaseUrl({ const expectedUrl = valueStreamBaseUrl({
...@@ -447,7 +447,7 @@ describe('Api', () => { ...@@ -447,7 +447,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsStageMedian({ groupId, valueStreamId, stageId, params }) Api.cycleAnalyticsStageMedian({ groupId, valueStreamId, stageId, params })
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
params, params,
...@@ -460,7 +460,7 @@ describe('Api', () => { ...@@ -460,7 +460,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsCreateStage', () => { describe('cycleAnalyticsCreateStage', () => {
it('submit the custom stage data', done => { it('submit the custom stage data', (done) => {
const response = {}; const response = {};
const customStage = { const customStage = {
name: 'cool-stage', name: 'cool-stage',
...@@ -488,7 +488,7 @@ describe('Api', () => { ...@@ -488,7 +488,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsUpdateStage', () => { describe('cycleAnalyticsUpdateStage', () => {
it('updates the stage data', done => { it('updates the stage data', (done) => {
const response = { id: stageId, custom: false, hidden: true, name: 'nice-stage' }; const response = { id: stageId, custom: false, hidden: true, name: 'nice-stage' };
const stageData = { name: 'nice-stage', hidden: true }; const stageData = { name: 'nice-stage', hidden: true };
const expectedUrl = valueStreamBaseUrl({ const expectedUrl = valueStreamBaseUrl({
...@@ -509,7 +509,7 @@ describe('Api', () => { ...@@ -509,7 +509,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsRemoveStage', () => { describe('cycleAnalyticsRemoveStage', () => {
it('deletes the specified data', done => { it('deletes the specified data', (done) => {
const response = { id: stageId, hidden: true, custom: true }; const response = { id: stageId, hidden: true, custom: true };
const expectedUrl = valueStreamBaseUrl({ const expectedUrl = valueStreamBaseUrl({
id: valueStreamId, id: valueStreamId,
...@@ -529,7 +529,7 @@ describe('Api', () => { ...@@ -529,7 +529,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsDurationChart', () => { describe('cycleAnalyticsDurationChart', () => {
it('fetches stage duration data', done => { it('fetches stage duration data', (done) => {
const response = []; const response = [];
const params = { ...defaultParams }; const params = { ...defaultParams };
const expectedUrl = valueStreamBaseUrl({ const expectedUrl = valueStreamBaseUrl({
...@@ -539,7 +539,7 @@ describe('Api', () => { ...@@ -539,7 +539,7 @@ describe('Api', () => {
mock.onGet(expectedUrl).reply(httpStatus.OK, response); mock.onGet(expectedUrl).reply(httpStatus.OK, response);
Api.cycleAnalyticsDurationChart({ groupId, valueStreamId, stageId, params }) Api.cycleAnalyticsDurationChart({ groupId, valueStreamId, stageId, params })
.then(responseObj => .then((responseObj) =>
expectRequestWithCorrectParameters(responseObj, { expectRequestWithCorrectParameters(responseObj, {
response, response,
params, params,
...@@ -552,7 +552,7 @@ describe('Api', () => { ...@@ -552,7 +552,7 @@ describe('Api', () => {
}); });
describe('cycleAnalyticsGroupLabels', () => { describe('cycleAnalyticsGroupLabels', () => {
it('fetches group level labels', done => { it('fetches group level labels', (done) => {
const response = []; const response = [];
const expectedUrl = `${dummyUrlRoot}/groups/${groupId}/-/labels.json`; const expectedUrl = `${dummyUrlRoot}/groups/${groupId}/-/labels.json`;
......
...@@ -17,7 +17,7 @@ describe('Approval Check Popover', () => { ...@@ -17,7 +17,7 @@ describe('Approval Check Popover', () => {
describe('with a documentation link', () => { describe('with a documentation link', () => {
const documentationLink = `${TEST_HOST}/documentation`; const documentationLink = `${TEST_HOST}/documentation`;
beforeEach(done => { beforeEach((done) => {
wrapper.setProps({ wrapper.setProps({
documentationLink, documentationLink,
}); });
......
...@@ -20,20 +20,20 @@ describe('Approval Check Popover', () => { ...@@ -20,20 +20,20 @@ describe('Approval Check Popover', () => {
describe('computed props', () => { describe('computed props', () => {
const securityApprovalsHelpPagePath = `${TEST_HOST}/documentation`; const securityApprovalsHelpPagePath = `${TEST_HOST}/documentation`;
beforeEach(done => { beforeEach((done) => {
wrapper.setProps({ securityApprovalsHelpPagePath }); wrapper.setProps({ securityApprovalsHelpPagePath });
Vue.nextTick(done); Vue.nextTick(done);
}); });
describe('showVulnerabilityCheckPopover', () => { describe('showVulnerabilityCheckPopover', () => {
it('return true if the rule type is "Vulnerability-Check"', done => { it('return true if the rule type is "Vulnerability-Check"', (done) => {
wrapper.setProps({ rule: { name: VULNERABILITY_CHECK_NAME } }); wrapper.setProps({ rule: { name: VULNERABILITY_CHECK_NAME } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.showVulnerabilityCheckPopover).toBe(true); expect(wrapper.vm.showVulnerabilityCheckPopover).toBe(true);
done(); done();
}); });
}); });
it('return false if the rule type is "Vulnerability-Check"', done => { it('return false if the rule type is "Vulnerability-Check"', (done) => {
wrapper.setProps({ rule: { name: 'FooRule' } }); wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.showVulnerabilityCheckPopover).toBe(false); expect(wrapper.vm.showVulnerabilityCheckPopover).toBe(false);
...@@ -43,14 +43,14 @@ describe('Approval Check Popover', () => { ...@@ -43,14 +43,14 @@ describe('Approval Check Popover', () => {
}); });
describe('showLicenseCheckPopover', () => { describe('showLicenseCheckPopover', () => {
it('return true if the rule type is "License-Check"', done => { it('return true if the rule type is "License-Check"', (done) => {
wrapper.setProps({ rule: { name: LICENSE_CHECK_NAME } }); wrapper.setProps({ rule: { name: LICENSE_CHECK_NAME } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.showLicenseCheckPopover).toBe(true); expect(wrapper.vm.showLicenseCheckPopover).toBe(true);
done(); done();
}); });
}); });
it('return false if the rule type is "License-Check"', done => { it('return false if the rule type is "License-Check"', (done) => {
wrapper.setProps({ rule: { name: 'FooRule' } }); wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.showLicenseCheckPopover).toBe(false); expect(wrapper.vm.showLicenseCheckPopover).toBe(false);
...@@ -60,7 +60,7 @@ describe('Approval Check Popover', () => { ...@@ -60,7 +60,7 @@ describe('Approval Check Popover', () => {
}); });
describe('approvalConfig', () => { describe('approvalConfig', () => {
it('returns "Vulberability-Check" config', done => { it('returns "Vulberability-Check" config', (done) => {
wrapper.setProps({ rule: { name: VULNERABILITY_CHECK_NAME } }); wrapper.setProps({ rule: { name: VULNERABILITY_CHECK_NAME } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.approvalRuleConfig.title).toBe( expect(wrapper.vm.approvalRuleConfig.title).toBe(
...@@ -75,7 +75,7 @@ describe('Approval Check Popover', () => { ...@@ -75,7 +75,7 @@ describe('Approval Check Popover', () => {
done(); done();
}); });
}); });
it('returns "License-Check" config', done => { it('returns "License-Check" config', (done) => {
wrapper.setProps({ rule: { name: LICENSE_CHECK_NAME } }); wrapper.setProps({ rule: { name: LICENSE_CHECK_NAME } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.approvalRuleConfig.title).toBe( expect(wrapper.vm.approvalRuleConfig.title).toBe(
...@@ -90,7 +90,7 @@ describe('Approval Check Popover', () => { ...@@ -90,7 +90,7 @@ describe('Approval Check Popover', () => {
done(); done();
}); });
}); });
it('returns an undefined config', done => { it('returns an undefined config', (done) => {
wrapper.setProps({ rule: { name: 'FooRule' } }); wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.approvalConfig).toBe(undefined); expect(wrapper.vm.approvalConfig).toBe(undefined);
...@@ -100,21 +100,21 @@ describe('Approval Check Popover', () => { ...@@ -100,21 +100,21 @@ describe('Approval Check Popover', () => {
}); });
describe('documentationLink', () => { describe('documentationLink', () => {
it('returns documentation link for "License-Check"', done => { it('returns documentation link for "License-Check"', (done) => {
wrapper.setProps({ rule: { name: 'License-Check' } }); wrapper.setProps({ rule: { name: 'License-Check' } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.documentationLink).toBe(securityApprovalsHelpPagePath); expect(wrapper.vm.documentationLink).toBe(securityApprovalsHelpPagePath);
done(); done();
}); });
}); });
it('returns documentation link for "Vulnerability-Check"', done => { it('returns documentation link for "Vulnerability-Check"', (done) => {
wrapper.setProps({ rule: { name: 'Vulnerability-Check' } }); wrapper.setProps({ rule: { name: 'Vulnerability-Check' } });
Vue.nextTick(() => { Vue.nextTick(() => {
expect(wrapper.vm.documentationLink).toBe(securityApprovalsHelpPagePath); expect(wrapper.vm.documentationLink).toBe(securityApprovalsHelpPagePath);
done(); done();
}); });
}); });
it('returns empty text', done => { it('returns empty text', (done) => {
const text = ''; const text = '';
wrapper.setProps({ rule: { name: 'FooRule' } }); wrapper.setProps({ rule: { name: 'FooRule' } });
Vue.nextTick(() => { Vue.nextTick(() => {
......
...@@ -26,13 +26,13 @@ const TEST_USERS = [ ...@@ -26,13 +26,13 @@ const TEST_USERS = [
const localVue = createLocalVue(); const localVue = createLocalVue();
const waitForEvent = ($input, event) => new Promise(resolve => $input.one(event, resolve)); const waitForEvent = ($input, event) => new Promise((resolve) => $input.one(event, resolve));
const parseAvatar = element => const parseAvatar = (element) =>
element.classList.contains('identicon') ? null : element.getAttribute('src'); element.classList.contains('identicon') ? null : element.getAttribute('src');
const select2Container = () => document.querySelector('.select2-container'); const select2Container = () => document.querySelector('.select2-container');
const select2DropdownOptions = () => document.querySelectorAll('#select2-drop .user-result'); const select2DropdownOptions = () => document.querySelectorAll('#select2-drop .user-result');
const select2DropdownItems = () => const select2DropdownItems = () =>
Array.prototype.map.call(select2DropdownOptions(), element => { Array.prototype.map.call(select2DropdownOptions(), (element) => {
const isGroup = element.classList.contains('group-result'); const isGroup = element.classList.contains('group-result');
const avatar = parseAvatar(element.querySelector('.avatar')); const avatar = parseAvatar(element.querySelector('.avatar'));
...@@ -92,7 +92,7 @@ describe('Approvals ApproversSelect', () => { ...@@ -92,7 +92,7 @@ describe('Approvals ApproversSelect', () => {
expect(select2Container()).not.toBe(null); expect(select2Container()).not.toBe(null);
}); });
it('queries and displays groups and users', async done => { it('queries and displays groups and users', async (done) => {
await factory(); await factory();
const expected = TEST_GROUPS.concat(TEST_USERS) const expected = TEST_GROUPS.concat(TEST_USERS)
...@@ -114,7 +114,7 @@ describe('Approvals ApproversSelect', () => { ...@@ -114,7 +114,7 @@ describe('Approvals ApproversSelect', () => {
describe('with search term', () => { describe('with search term', () => {
const term = 'lorem'; const term = 'lorem';
beforeEach(async done => { beforeEach(async (done) => {
await factory(); await factory();
waitForEvent($input, 'select2-loaded') waitForEvent($input, 'select2-loaded')
...@@ -140,7 +140,7 @@ describe('Approvals ApproversSelect', () => { ...@@ -140,7 +140,7 @@ describe('Approvals ApproversSelect', () => {
const skipGroupIds = [7, 8]; const skipGroupIds = [7, 8];
const skipUserIds = [9, 10]; const skipUserIds = [9, 10];
beforeEach(async done => { beforeEach(async (done) => {
await factory({ await factory({
propsData: { propsData: {
skipGroupIds, skipGroupIds,
...@@ -170,7 +170,7 @@ describe('Approvals ApproversSelect', () => { ...@@ -170,7 +170,7 @@ describe('Approvals ApproversSelect', () => {
}); });
}); });
it('emits input when data changes', async done => { it('emits input when data changes', async (done) => {
await factory(); await factory();
const expectedFinal = [ const expectedFinal = [
......
...@@ -12,11 +12,11 @@ const TEST_PROTECTED_BRANCHES = [ ...@@ -12,11 +12,11 @@ const TEST_PROTECTED_BRANCHES = [
{ id: 2, name: 'development' }, { id: 2, name: 'development' },
]; ];
const TEST_BRANCHES_SELECTIONS = [TEST_DEFAULT_BRANCH, ...TEST_PROTECTED_BRANCHES]; const TEST_BRANCHES_SELECTIONS = [TEST_DEFAULT_BRANCH, ...TEST_PROTECTED_BRANCHES];
const waitForEvent = ($input, event) => new Promise(resolve => $input.one(event, resolve)); const waitForEvent = ($input, event) => new Promise((resolve) => $input.one(event, resolve));
const select2Container = () => document.querySelector('.select2-container'); const select2Container = () => document.querySelector('.select2-container');
const select2DropdownOptions = () => document.querySelectorAll('.result-name'); const select2DropdownOptions = () => document.querySelectorAll('.result-name');
const branchNames = () => TEST_BRANCHES_SELECTIONS.map(branch => branch.name); const branchNames = () => TEST_BRANCHES_SELECTIONS.map((branch) => branch.name);
const protectedBranchNames = () => TEST_PROTECTED_BRANCHES.map(branch => branch.name); const protectedBranchNames = () => TEST_PROTECTED_BRANCHES.map((branch) => branch.name);
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
...@@ -64,12 +64,12 @@ describe('Branches Select', () => { ...@@ -64,12 +64,12 @@ describe('Branches Select', () => {
expect(select2Container()).not.toBe(null); expect(select2Container()).not.toBe(null);
}); });
it('displays all the protected branches and any branch', async done => { it('displays all the protected branches and any branch', async (done) => {
await createComponent(); await createComponent();
waitForEvent($input, 'select2-loaded') waitForEvent($input, 'select2-loaded')
.then(() => { .then(() => {
const nodeList = select2DropdownOptions(); const nodeList = select2DropdownOptions();
const names = [...nodeList].map(el => el.textContent); const names = [...nodeList].map((el) => el.textContent);
expect(names).toEqual(branchNames()); expect(names).toEqual(branchNames());
}) })
...@@ -83,7 +83,7 @@ describe('Branches Select', () => { ...@@ -83,7 +83,7 @@ describe('Branches Select', () => {
return createComponent(); return createComponent();
}); });
it('fetches protected branches with search term', done => { it('fetches protected branches with search term', (done) => {
const term = 'lorem'; const term = 'lorem';
waitForEvent($input, 'select2-loaded') waitForEvent($input, 'select2-loaded')
.then(() => {}) .then(() => {})
...@@ -95,11 +95,11 @@ describe('Branches Select', () => { ...@@ -95,11 +95,11 @@ describe('Branches Select', () => {
expect(Api.projectProtectedBranches).toHaveBeenCalledWith(TEST_PROJECT_ID, term); expect(Api.projectProtectedBranches).toHaveBeenCalledWith(TEST_PROJECT_ID, term);
}); });
it('fetches protected branches with no any branch if there is search', done => { it('fetches protected branches with no any branch if there is search', (done) => {
waitForEvent($input, 'select2-loaded') waitForEvent($input, 'select2-loaded')
.then(() => { .then(() => {
const nodeList = select2DropdownOptions(); const nodeList = select2DropdownOptions();
const names = [...nodeList].map(el => el.textContent); const names = [...nodeList].map((el) => el.textContent);
expect(names).toEqual(protectedBranchNames()); expect(names).toEqual(protectedBranchNames());
}) })
...@@ -108,11 +108,11 @@ describe('Branches Select', () => { ...@@ -108,11 +108,11 @@ describe('Branches Select', () => {
search('master'); search('master');
}); });
it('fetches protected branches with any branch if search contains term "any"', done => { it('fetches protected branches with any branch if search contains term "any"', (done) => {
waitForEvent($input, 'select2-loaded') waitForEvent($input, 'select2-loaded')
.then(() => { .then(() => {
const nodeList = select2DropdownOptions(); const nodeList = select2DropdownOptions();
const names = [...nodeList].map(el => el.textContent); const names = [...nodeList].map((el) => el.textContent);
expect(names).toEqual(branchNames()); expect(names).toEqual(branchNames());
}) })
...@@ -122,7 +122,7 @@ describe('Branches Select', () => { ...@@ -122,7 +122,7 @@ describe('Branches Select', () => {
}); });
}); });
it('emits input when data changes', async done => { it('emits input when data changes', async (done) => {
await createComponent(); await createComponent();
const selectedIndex = 1; const selectedIndex = 1;
......
...@@ -55,7 +55,7 @@ describe('EE Approvals LicenseCompliance', () => { ...@@ -55,7 +55,7 @@ describe('EE Approvals LicenseCompliance', () => {
wrapper = null; wrapper = null;
}); });
const findByHrefAttribute = href => wrapper.find(`[href="${href}"]`); const findByHrefAttribute = (href) => wrapper.find(`[href="${href}"]`);
const findOpenModalButton = () => wrapper.find('button'); const findOpenModalButton = () => wrapper.find('button');
const findLoadingIndicator = () => wrapper.find('[aria-label="loading"]'); const findLoadingIndicator = () => wrapper.find('[aria-label="loading"]');
const findInformationIcon = () => wrapper.find(GlIcon); const findInformationIcon = () => wrapper.find(GlIcon);
......
...@@ -72,7 +72,7 @@ describe('EE Approvals LicenseCompliance Modal', () => { ...@@ -72,7 +72,7 @@ describe('EE Approvals LicenseCompliance Modal', () => {
wrapper = null; wrapper = null;
}); });
const findByHref = href => wrapper.find(`[href="${href}"`); const findByHref = (href) => wrapper.find(`[href="${href}"`);
const findModal = () => wrapper.find(GlModalVuex); const findModal = () => wrapper.find(GlModalVuex);
const findRuleForm = () => wrapper.find(mocks.RuleForm); const findRuleForm = () => wrapper.find(mocks.RuleForm);
const findInformationIcon = () => wrapper.find('[name="question"]'); const findInformationIcon = () => wrapper.find('[name="question"]');
......
...@@ -49,7 +49,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => { ...@@ -49,7 +49,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
}); });
const findHiddenInputs = () => const findHiddenInputs = () =>
wrapper.findAll('input[type=hidden]').wrappers.map(x => ({ wrapper.findAll('input[type=hidden]').wrappers.map((x) => ({
name: x.attributes('name'), name: x.attributes('name'),
value: x.element.value, value: x.element.value,
})); }));
...@@ -137,7 +137,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => { ...@@ -137,7 +137,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
it('renders empty users input', () => { it('renders empty users input', () => {
factory(); factory();
expect(findHiddenInputs().filter(x => x.name === INPUT_USER_IDS)).toEqual([ expect(findHiddenInputs().filter((x) => x.name === INPUT_USER_IDS)).toEqual([
{ name: INPUT_USER_IDS, value: '' }, { name: INPUT_USER_IDS, value: '' },
]); ]);
}); });
...@@ -151,7 +151,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => { ...@@ -151,7 +151,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
it('renders empty groups input', () => { it('renders empty groups input', () => {
factory(); factory();
expect(findHiddenInputs().filter(x => x.name === INPUT_GROUP_IDS)).toEqual([ expect(findHiddenInputs().filter((x) => x.name === INPUT_GROUP_IDS)).toEqual([
{ name: INPUT_GROUP_IDS, value: '' }, { name: INPUT_GROUP_IDS, value: '' },
]); ]);
}); });
...@@ -165,7 +165,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => { ...@@ -165,7 +165,7 @@ describe('EE Approvlas MRRulesHiddenInputs', () => {
it('does render id input', () => { it('does render id input', () => {
factory(); factory();
expect(findHiddenInputs().map(x => x.name)).toContain(INPUT_ID); expect(findHiddenInputs().map((x) => x.name)).toContain(INPUT_ID);
}); });
describe('with source', () => { describe('with source', () => {
......
...@@ -31,12 +31,12 @@ describe('EE Approvals MRRules', () => { ...@@ -31,12 +31,12 @@ describe('EE Approvals MRRules', () => {
}); });
}; };
const findHeaders = () => wrapper.findAll('thead th').wrappers.map(x => x.text()); const findHeaders = () => wrapper.findAll('thead th').wrappers.map((x) => x.text());
const findRuleName = () => wrapper.find('.js-name'); const findRuleName = () => wrapper.find('.js-name');
const findRuleIndicator = () => wrapper.find({ ref: 'indicator' }); const findRuleIndicator = () => wrapper.find({ ref: 'indicator' });
const findRuleMembers = () => wrapper.find('td.js-members').find(UserAvatarList).props('items'); const findRuleMembers = () => wrapper.find('td.js-members').find(UserAvatarList).props('items');
const findRuleControls = () => wrapper.find('td.js-controls').find(RuleControls); const findRuleControls = () => wrapper.find('td.js-controls').find(RuleControls);
const callTargetBranchHandler = MutationObserverSpy => { const callTargetBranchHandler = (MutationObserverSpy) => {
const onTargetBranchMutationHandler = MutationObserverSpy.mock.calls[0][0]; const onTargetBranchMutationHandler = MutationObserverSpy.mock.calls[0][0];
return onTargetBranchMutationHandler(); return onTargetBranchMutationHandler();
}; };
...@@ -45,7 +45,7 @@ describe('EE Approvals MRRules', () => { ...@@ -45,7 +45,7 @@ describe('EE Approvals MRRules', () => {
OriginalMutationObserver = global.MutationObserver; OriginalMutationObserver = global.MutationObserver;
global.MutationObserver = jest global.MutationObserver = jest
.fn() .fn()
.mockImplementation(args => new OriginalMutationObserver(args)); .mockImplementation((args) => new OriginalMutationObserver(args));
store = createStoreOptions(MREditModule()); store = createStoreOptions(MREditModule());
store.modules.approvals.state = { store.modules.approvals.state = {
...@@ -157,7 +157,7 @@ describe('EE Approvals MRRules', () => { ...@@ -157,7 +157,7 @@ describe('EE Approvals MRRules', () => {
factory(); factory();
const anyApproverCount = store.modules.approvals.state.rules.filter( const anyApproverCount = store.modules.approvals.state.rules.filter(
rule => rule.ruleType === 'any_approver', (rule) => rule.ruleType === 'any_approver',
); );
expect(anyApproverCount).toHaveLength(1); expect(anyApproverCount).toHaveLength(1);
......
...@@ -16,7 +16,7 @@ localVue.use(Vuex); ...@@ -16,7 +16,7 @@ localVue.use(Vuex);
const findCell = (tr, name) => tr.find(`td.js-${name}`); const findCell = (tr, name) => tr.find(`td.js-${name}`);
const getRowData = tr => { const getRowData = (tr) => {
const name = findCell(tr, 'name'); const name = findCell(tr, 'name');
const members = findCell(tr, 'members'); const members = findCell(tr, 'members');
const approvalsRequired = findCell(tr, 'approvals-required'); const approvalsRequired = findCell(tr, 'approvals-required');
...@@ -61,7 +61,7 @@ describe('Approvals ProjectRules', () => { ...@@ -61,7 +61,7 @@ describe('Approvals ProjectRules', () => {
const data = rows.wrappers.map(getRowData); const data = rows.wrappers.map(getRowData);
expect(data).toEqual( expect(data).toEqual(
TEST_RULES.filter((rule, index) => index !== 0).map(rule => ({ TEST_RULES.filter((rule, index) => index !== 0).map((rule) => ({
name: rule.name, name: rule.name,
approvers: rule.approvers, approvers: rule.approvers,
approvalsRequired: rule.approvalsRequired, approvalsRequired: rule.approvalsRequired,
...@@ -74,7 +74,7 @@ describe('Approvals ProjectRules', () => { ...@@ -74,7 +74,7 @@ describe('Approvals ProjectRules', () => {
it('should always have any_approver rule', () => { it('should always have any_approver rule', () => {
factory(); factory();
const hasAnyApproverRule = store.modules.approvals.state.rules.some( const hasAnyApproverRule = store.modules.approvals.state.rules.some(
rule => rule.ruleType === 'any_approver', (rule) => rule.ruleType === 'any_approver',
); );
expect(hasAnyApproverRule).toBe(true); expect(hasAnyApproverRule).toBe(true);
...@@ -133,7 +133,7 @@ describe('Approvals ProjectRules', () => { ...@@ -133,7 +133,7 @@ describe('Approvals ProjectRules', () => {
describe.each([true, false])( describe.each([true, false])(
'when the approvalSuggestions feature flag is %p', 'when the approvalSuggestions feature flag is %p',
approvalSuggestions => { (approvalSuggestions) => {
beforeEach(() => { beforeEach(() => {
const rules = createProjectRules(); const rules = createProjectRules();
rules[0].name = 'Vulnerability-Check'; rules[0].name = 'Vulnerability-Check';
......
...@@ -41,7 +41,7 @@ const nameTakenError = { ...@@ -41,7 +41,7 @@ const nameTakenError = {
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
const addType = type => x => Object.assign(x, { type }); const addType = (type) => (x) => Object.assign(x, { type });
describe('EE Approvals RuleForm', () => { describe('EE Approvals RuleForm', () => {
let wrapper; let wrapper;
...@@ -88,7 +88,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -88,7 +88,7 @@ describe('EE Approvals RuleForm', () => {
beforeEach(() => { beforeEach(() => {
store = createStoreOptions(projectSettingsModule(), { projectId: TEST_PROJECT_ID }); store = createStoreOptions(projectSettingsModule(), { projectId: TEST_PROJECT_ID });
['postRule', 'putRule', 'deleteRule', 'putFallbackRule'].forEach(actionName => { ['postRule', 'putRule', 'deleteRule', 'putFallbackRule'].forEach((actionName) => {
jest.spyOn(store.modules.approvals.actions, actionName).mockImplementation(() => {}); jest.spyOn(store.modules.approvals.actions, actionName).mockImplementation(() => {});
}); });
...@@ -114,7 +114,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -114,7 +114,7 @@ describe('EE Approvals RuleForm', () => {
}); });
it('on load, it populates initial protected branch ids', () => { it('on load, it populates initial protected branch ids', () => {
expect(wrapper.vm.branches).toEqual(TEST_PROTECTED_BRANCHES.map(x => x.id)); expect(wrapper.vm.branches).toEqual(TEST_PROTECTED_BRANCHES.map((x) => x.id));
}); });
}); });
...@@ -128,14 +128,14 @@ describe('EE Approvals RuleForm', () => { ...@@ -128,14 +128,14 @@ describe('EE Approvals RuleForm', () => {
it('at first, shows no validation', () => { it('at first, shows no validation', () => {
const inputs = findValidationsWithBranch(); const inputs = findValidationsWithBranch();
const invalidInputs = inputs.filter(x => !x.isValid); const invalidInputs = inputs.filter((x) => !x.isValid);
const feedbacks = inputs.map(x => x.feedback); const feedbacks = inputs.map((x) => x.feedback);
expect(invalidInputs.length).toBe(0); expect(invalidInputs.length).toBe(0);
expect(feedbacks.every(str => !str.length)).toBe(true); expect(feedbacks.every((str) => !str.length)).toBe(true);
}); });
it('on submit, shows branches validation', done => { it('on submit, shows branches validation', (done) => {
wrapper.vm.branches = ['3']; wrapper.vm.branches = ['3'];
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -154,9 +154,9 @@ describe('EE Approvals RuleForm', () => { ...@@ -154,9 +154,9 @@ describe('EE Approvals RuleForm', () => {
it('on submit with data, posts rule', () => { it('on submit with data, posts rule', () => {
const users = [1, 2]; const users = [1, 2];
const groups = [2, 3]; const groups = [2, 3];
const userRecords = users.map(id => ({ id, type: TYPE_USER })); const userRecords = users.map((id) => ({ id, type: TYPE_USER }));
const groupRecords = groups.map(id => ({ id, type: TYPE_GROUP })); const groupRecords = groups.map((id) => ({ id, type: TYPE_GROUP }));
const branches = TEST_PROTECTED_BRANCHES.map(x => x.id); const branches = TEST_PROTECTED_BRANCHES.map((x) => x.id);
const expected = { const expected = {
id: null, id: null,
name: 'Lorem', name: 'Lorem',
...@@ -188,11 +188,11 @@ describe('EE Approvals RuleForm', () => { ...@@ -188,11 +188,11 @@ describe('EE Approvals RuleForm', () => {
it('at first, shows no validation', () => { it('at first, shows no validation', () => {
const inputs = findValidations(); const inputs = findValidations();
const invalidInputs = inputs.filter(x => !x.isValid); const invalidInputs = inputs.filter((x) => !x.isValid);
const feedbacks = inputs.map(x => x.feedback); const feedbacks = inputs.map((x) => x.feedback);
expect(invalidInputs.length).toBe(0); expect(invalidInputs.length).toBe(0);
expect(feedbacks.every(str => !str.length)).toBe(true); expect(feedbacks.every((str) => !str.length)).toBe(true);
}); });
it('on submit, does not dispatch action', () => { it('on submit, does not dispatch action', () => {
...@@ -201,7 +201,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -201,7 +201,7 @@ describe('EE Approvals RuleForm', () => {
expect(actions.postRule).not.toHaveBeenCalled(); expect(actions.postRule).not.toHaveBeenCalled();
}); });
it('on submit, shows name validation', done => { it('on submit, shows name validation', (done) => {
findNameInput().setValue(''); findNameInput().setValue('');
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -218,7 +218,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -218,7 +218,7 @@ describe('EE Approvals RuleForm', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('on submit, shows approvalsRequired validation', done => { it('on submit, shows approvalsRequired validation', (done) => {
findApprovalsRequiredInput().setValue(-1); findApprovalsRequiredInput().setValue(-1);
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -235,7 +235,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -235,7 +235,7 @@ describe('EE Approvals RuleForm', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('on submit, shows approvers validation', done => { it('on submit, shows approvers validation', (done) => {
wrapper.vm.approvers = []; wrapper.vm.approvers = [];
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -254,9 +254,9 @@ describe('EE Approvals RuleForm', () => { ...@@ -254,9 +254,9 @@ describe('EE Approvals RuleForm', () => {
describe('with valid data', () => { describe('with valid data', () => {
const users = [1, 2]; const users = [1, 2];
const groups = [2, 3]; const groups = [2, 3];
const userRecords = users.map(id => ({ id, type: TYPE_USER })); const userRecords = users.map((id) => ({ id, type: TYPE_USER }));
const groupRecords = groups.map(id => ({ id, type: TYPE_GROUP })); const groupRecords = groups.map((id) => ({ id, type: TYPE_GROUP }));
const branches = TEST_PROTECTED_BRANCHES.map(x => x.id); const branches = TEST_PROTECTED_BRANCHES.map((x) => x.id);
const expected = { const expected = {
id: null, id: null,
name: 'Lorem', name: 'Lorem',
...@@ -333,10 +333,10 @@ describe('EE Approvals RuleForm', () => { ...@@ -333,10 +333,10 @@ describe('EE Approvals RuleForm', () => {
}); });
describe('with valid data', () => { describe('with valid data', () => {
const userRecords = TEST_RULE.users.map(x => ({ ...x, type: TYPE_USER })); const userRecords = TEST_RULE.users.map((x) => ({ ...x, type: TYPE_USER }));
const groupRecords = TEST_RULE.groups.map(x => ({ ...x, type: TYPE_GROUP })); const groupRecords = TEST_RULE.groups.map((x) => ({ ...x, type: TYPE_GROUP }));
const users = userRecords.map(x => x.id); const users = userRecords.map((x) => x.id);
const groups = groupRecords.map(x => x.id); const groups = groupRecords.map((x) => x.id);
const expected = { const expected = {
...TEST_RULE, ...TEST_RULE,
...@@ -392,7 +392,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -392,7 +392,7 @@ describe('EE Approvals RuleForm', () => {
}); });
describe('with empty name and empty approvers', () => { describe('with empty name and empty approvers', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.vm.submit(); wrapper.vm.submit();
localVue.nextTick(done); localVue.nextTick(done);
}); });
...@@ -408,12 +408,12 @@ describe('EE Approvals RuleForm', () => { ...@@ -408,12 +408,12 @@ describe('EE Approvals RuleForm', () => {
}); });
it('does not show any validation errors', () => { it('does not show any validation errors', () => {
expect(findValidations().every(x => x.isValid)).toBe(true); expect(findValidations().every((x) => x.isValid)).toBe(true);
}); });
}); });
describe('with name and empty approvers', () => { describe('with name and empty approvers', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.vm.name = 'Lorem'; wrapper.vm.name = 'Lorem';
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -430,7 +430,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -430,7 +430,7 @@ describe('EE Approvals RuleForm', () => {
}); });
describe('with empty name and approvers', () => { describe('with empty name and approvers', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.vm.approvers = TEST_APPROVERS; wrapper.vm.approvers = TEST_APPROVERS;
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -447,7 +447,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -447,7 +447,7 @@ describe('EE Approvals RuleForm', () => {
}); });
describe('with name and approvers', () => { describe('with name and approvers', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.vm.approvers = [{ id: 7, type: TYPE_USER }]; wrapper.vm.approvers = [{ id: 7, type: TYPE_USER }];
wrapper.vm.name = 'Lorem'; wrapper.vm.name = 'Lorem';
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -498,7 +498,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -498,7 +498,7 @@ describe('EE Approvals RuleForm', () => {
describe('and hidden groups removed', () => { describe('and hidden groups removed', () => {
beforeEach(() => { beforeEach(() => {
wrapper.vm.approvers = wrapper.vm.approvers.filter(x => x.type !== TYPE_HIDDEN_GROUPS); wrapper.vm.approvers = wrapper.vm.approvers.filter((x) => x.type !== TYPE_HIDDEN_GROUPS);
}); });
it('on submit, removes hidden groups', () => { it('on submit, removes hidden groups', () => {
...@@ -529,7 +529,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -529,7 +529,7 @@ describe('EE Approvals RuleForm', () => {
expect( expect(
findApproversList() findApproversList()
.props('value') .props('value')
.every(x => x.type !== TYPE_HIDDEN_GROUPS), .every((x) => x.type !== TYPE_HIDDEN_GROUPS),
).toBe(true); ).toBe(true);
}); });
}); });
...@@ -656,7 +656,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -656,7 +656,7 @@ describe('EE Approvals RuleForm', () => {
expect.objectContaining({ expect.objectContaining({
name: expectedNameSubmitted, name: expectedNameSubmitted,
approvalsRequired: TEST_APPROVALS_REQUIRED, approvalsRequired: TEST_APPROVALS_REQUIRED,
users: TEST_APPROVERS.map(x => x.id), users: TEST_APPROVERS.map((x) => x.id),
}), }),
); );
}); });
...@@ -712,7 +712,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -712,7 +712,7 @@ describe('EE Approvals RuleForm', () => {
}); });
describe('with name and approvers', () => { describe('with name and approvers', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.vm.name = inputName; wrapper.vm.name = inputName;
wrapper.vm.approvers = TEST_APPROVERS; wrapper.vm.approvers = TEST_APPROVERS;
wrapper.vm.submit(); wrapper.vm.submit();
...@@ -727,7 +727,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -727,7 +727,7 @@ describe('EE Approvals RuleForm', () => {
id: TEST_RULE.id, id: TEST_RULE.id,
name: expectedNameSubmitted, name: expectedNameSubmitted,
approvalsRequired: TEST_APPROVALS_REQUIRED, approvalsRequired: TEST_APPROVALS_REQUIRED,
users: TEST_APPROVERS.map(x => x.id), users: TEST_APPROVERS.map((x) => x.id),
}), }),
); );
}); });
......
...@@ -4,7 +4,7 @@ import testAction from 'helpers/vuex_action_helper'; ...@@ -4,7 +4,7 @@ import testAction from 'helpers/vuex_action_helper';
describe('Approval MR edit module actions', () => { describe('Approval MR edit module actions', () => {
describe('setTargetBranch', () => { describe('setTargetBranch', () => {
it('commits SET_TARGET_BRANCH', done => { it('commits SET_TARGET_BRANCH', (done) => {
testAction( testAction(
actions.setTargetBranch, actions.setTargetBranch,
'master', 'master',
...@@ -17,7 +17,7 @@ describe('Approval MR edit module actions', () => { ...@@ -17,7 +17,7 @@ describe('Approval MR edit module actions', () => {
}); });
describe('undoRulesChange', () => { describe('undoRulesChange', () => {
it('commits UNDO_RULES', done => { it('commits UNDO_RULES', (done) => {
testAction(actions.undoRulesChange, null, {}, [{ type: types.UNDO_RULES }], [], done); testAction(actions.undoRulesChange, null, {}, [{ type: types.UNDO_RULES }], [], done);
}); });
}); });
......
...@@ -101,7 +101,7 @@ describe('EE approvals project settings module actions', () => { ...@@ -101,7 +101,7 @@ describe('EE approvals project settings module actions', () => {
{ type: 'receiveRulesSuccess', payload: mapApprovalSettingsResponse(data) }, { type: 'receiveRulesSuccess', payload: mapApprovalSettingsResponse(data) },
], ],
() => { () => {
expect(mock.history.get.map(x => x.url)).toEqual([TEST_SETTINGS_PATH]); expect(mock.history.get.map((x) => x.url)).toEqual([TEST_SETTINGS_PATH]);
}, },
); );
}); });
......
...@@ -19,7 +19,7 @@ describe('AuditEventsApp', () => { ...@@ -19,7 +19,7 @@ describe('AuditEventsApp', () => {
let store; let store;
const events = [{ foo: 'bar' }]; const events = [{ foo: 'bar' }];
const filterTokenOptions = AVAILABLE_TOKEN_TYPES.map(type => ({ type })); const filterTokenOptions = AVAILABLE_TOKEN_TYPES.map((type) => ({ type }));
const exportUrl = 'http://example.com/audit_log_reports.csv'; const exportUrl = 'http://example.com/audit_log_reports.csv';
const initComponent = (props = {}) => { const initComponent = (props = {}) => {
......
...@@ -12,7 +12,7 @@ describe('SortingField component', () => { ...@@ -12,7 +12,7 @@ describe('SortingField component', () => {
}; };
const getCheckedOptions = () => const getCheckedOptions = () =>
wrapper.findAll(GlDropdownItem).filter(item => item.props().isChecked); wrapper.findAll(GlDropdownItem).filter((item) => item.props().isChecked);
beforeEach(() => { beforeEach(() => {
initComponent(); initComponent();
......
...@@ -19,7 +19,7 @@ describe('AuditFilterToken', () => { ...@@ -19,7 +19,7 @@ describe('AuditFilterToken', () => {
]; ];
const findFilteredSearchToken = () => wrapper.find('#filtered-search-token'); const findFilteredSearchToken = () => wrapper.find('#filtered-search-token');
const findLoadingIcon = type => wrapper.find(type).find(GlLoadingIcon); const findLoadingIcon = (type) => wrapper.find(type).find(GlLoadingIcon);
const tokenMethods = { const tokenMethods = {
fetchItem: jest.fn().mockResolvedValue(item), fetchItem: jest.fn().mockResolvedValue(item),
......
import subscriptionState from 'ee/billings/subscriptions/store/state'; import subscriptionState from 'ee/billings/subscriptions/store/state';
export const resetStore = store => { export const resetStore = (store) => {
const newState = { const newState = {
subscription: subscriptionState(), subscription: subscriptionState(),
}; };
......
...@@ -55,7 +55,7 @@ describe('Subscription Seats', () => { ...@@ -55,7 +55,7 @@ describe('Subscription Seats', () => {
const findPageHeading = () => wrapper.find('[data-testid="heading"]'); const findPageHeading = () => wrapper.find('[data-testid="heading"]');
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.find(GlPagination);
const serializeUser = rowWrapper => { const serializeUser = (rowWrapper) => {
const avatarLink = rowWrapper.find(GlAvatarLink); const avatarLink = rowWrapper.find(GlAvatarLink);
const avatarLabeled = rowWrapper.find(GlAvatarLabeled); const avatarLabeled = rowWrapper.find(GlAvatarLabeled);
...@@ -72,7 +72,7 @@ describe('Subscription Seats', () => { ...@@ -72,7 +72,7 @@ describe('Subscription Seats', () => {
}; };
}; };
const serializeTableRow = rowWrapper => { const serializeTableRow = (rowWrapper) => {
const emailWrapper = rowWrapper.find('[data-testid="email"]'); const emailWrapper = rowWrapper.find('[data-testid="email"]');
return { return {
...@@ -82,7 +82,7 @@ describe('Subscription Seats', () => { ...@@ -82,7 +82,7 @@ describe('Subscription Seats', () => {
}; };
}; };
const findSerializedTable = tableWrapper => { const findSerializedTable = (tableWrapper) => {
return tableWrapper.findAll('tbody tr').wrappers.map(serializeTableRow); return tableWrapper.findAll('tbody tr').wrappers.map(serializeTableRow);
}; };
...@@ -141,7 +141,7 @@ describe('Subscription Seats', () => { ...@@ -141,7 +141,7 @@ describe('Subscription Seats', () => {
describe('pagination', () => { describe('pagination', () => {
it.each([null, NaN, undefined, 'a string', false])( it.each([null, NaN, undefined, 'a string', false])(
'will not render given %s for currentPage', 'will not render given %s for currentPage',
value => { (value) => {
wrapper = createComponent({ wrapper = createComponent({
initialState: { initialState: {
page: value, page: value,
......
...@@ -100,7 +100,7 @@ describe('seats actions', () => { ...@@ -100,7 +100,7 @@ describe('seats actions', () => {
}); });
describe('receiveBillableMembersListError', () => { describe('receiveBillableMembersListError', () => {
it('should commit the error mutation', done => { it('should commit the error mutation', (done) => {
testAction( testAction(
actions.receiveBillableMembersListError, actions.receiveBillableMembersListError,
{}, {},
......
...@@ -76,7 +76,7 @@ describe('subscription table row', () => { ...@@ -76,7 +76,7 @@ describe('subscription table row', () => {
const findContentCells = () => wrapper.findAll('[data-testid="content-cell"]'); const findContentCells = () => wrapper.findAll('[data-testid="content-cell"]');
const findHeaderIcon = () => findHeaderCell().find(GlIcon); const findHeaderIcon = () => findHeaderCell().find(GlIcon);
const findColumnLabelAndTitle = columnWrapper => { const findColumnLabelAndTitle = (columnWrapper) => {
const label = columnWrapper.find('[data-testid="property-label"]'); const label = columnWrapper.find('[data-testid="property-label"]');
const value = columnWrapper.find('[data-testid="property-value"]'); const value = columnWrapper.find('[data-testid="property-value"]');
...@@ -111,7 +111,7 @@ describe('subscription table row', () => { ...@@ -111,7 +111,7 @@ describe('subscription table row', () => {
}); });
it(`should not render a hidden column`, () => { it(`should not render a hidden column`, () => {
const hiddenColIdx = COLUMNS.find(c => !c.display); const hiddenColIdx = COLUMNS.find((c) => !c.display);
const hiddenCol = findContentCells().at(hiddenColIdx); const hiddenCol = findContentCells().at(hiddenColIdx);
expect(hiddenCol).toBe(undefined); expect(hiddenCol).toBe(undefined);
......
...@@ -39,7 +39,7 @@ describe('EE billings subscription module mutations', () => { ...@@ -39,7 +39,7 @@ describe('EE billings subscription module mutations', () => {
}); });
describe(types.RECEIVE_SUBSCRIPTION_SUCCESS, () => { describe(types.RECEIVE_SUBSCRIPTION_SUCCESS, () => {
const getColumnValues = columns => const getColumnValues = (columns) =>
columns.reduce( columns.reduce(
(acc, { id, value }) => ({ (acc, { id, value }) => ({
...acc, ...acc,
...@@ -47,7 +47,7 @@ describe('EE billings subscription module mutations', () => { ...@@ -47,7 +47,7 @@ describe('EE billings subscription module mutations', () => {
}), }),
{}, {},
); );
const getStateTableValues = key => const getStateTableValues = (key) =>
state.tables[key].rows.map(({ columns }) => getColumnValues(columns)); state.tables[key].rows.map(({ columns }) => getColumnValues(columns));
describe.each` describe.each`
......
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