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

Run prettier on 29 files - 44 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -1368,35 +1368,6 @@ ee/app/assets/javascripts/vulnerabilities/components/resolution_alert.vue ...@@ -1368,35 +1368,6 @@ ee/app/assets/javascripts/vulnerabilities/components/resolution_alert.vue
## wonderful-proskuriakova ## wonderful-proskuriakova
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
ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_segment_modal_spec.js
ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_table_cell_flag_spec.js
ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_table_spec.js
ee/spec/frontend/analytics/code_review_analytics/components/app_spec.js
ee/spec/frontend/analytics/code_review_analytics/components/filter_bar_spec.js
ee/spec/frontend/analytics/code_review_analytics/components/merge_request_table_spec.js
ee/spec/frontend/analytics/code_review_analytics/store/modules/merge_requests/actions_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/base_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/create_value_stream_form/custom_stage_fields_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/custom_stage_form_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/duration_chart_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/filter_bar_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/labels_selector_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/metrics_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/path_navigation_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/stage_dropdown_filter_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/stage_event_list_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/stage_nav_item_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/stage_table_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/type_of_work_charts_spec.js
ee/spec/frontend/analytics/cycle_analytics/components/value_stream_select_spec.js
ee/spec/frontend/analytics/cycle_analytics/helpers.js
ee/spec/frontend/analytics/cycle_analytics/mock_data.js
ee/spec/frontend/analytics/cycle_analytics/store/getters_spec.js
ee/spec/frontend/analytics/cycle_analytics/store/mutations_spec.js
ee/spec/frontend/analytics/cycle_analytics/utils_spec.js
ee/spec/frontend/analytics/merge_request_analytics/components/filter_bar_spec.js
ee/spec/frontend/analytics/merge_request_analytics/components/throughput_table_spec.js
## inspiring-banach ## inspiring-banach
ee/spec/frontend/analytics/productivity_analytics/components/app_spec.js ee/spec/frontend/analytics/productivity_analytics/components/app_spec.js
......
...@@ -29,7 +29,7 @@ const mutate = jest.fn().mockResolvedValue({ ...@@ -29,7 +29,7 @@ const mutate = jest.fn().mockResolvedValue({
}, },
}, },
}); });
const mutateWithDataErrors = segment => const mutateWithDataErrors = (segment) =>
jest.fn().mockResolvedValue({ jest.fn().mockResolvedValue({
data: { data: {
[segment ? 'updateDevopsAdoptionSegment' : 'createDevopsAdoptionSegment']: { [segment ? 'updateDevopsAdoptionSegment' : 'createDevopsAdoptionSegment']: {
...@@ -64,13 +64,13 @@ describe('DevopsAdoptionSegmentModal', () => { ...@@ -64,13 +64,13 @@ describe('DevopsAdoptionSegmentModal', () => {
}; };
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.find(GlModal);
const findByTestId = testId => findModal().find(`[data-testid="${testId}"]`); const findByTestId = (testId) => findModal().find(`[data-testid="${testId}"]`);
const actionButtonDisabledState = () => findModal().props('actionPrimary').attributes[0].disabled; const actionButtonDisabledState = () => findModal().props('actionPrimary').attributes[0].disabled;
const cancelButtonDisabledState = () => findModal().props('actionCancel').attributes[0].disabled; const cancelButtonDisabledState = () => findModal().props('actionCancel').attributes[0].disabled;
const actionButtonLoadingState = () => findModal().props('actionPrimary').attributes[0].loading; const actionButtonLoadingState = () => findModal().props('actionPrimary').attributes[0].loading;
const findAlert = () => findModal().find(GlAlert); const findAlert = () => findModal().find(GlAlert);
const assertHelperText = text => expect(getByText(wrapper.element, text)).not.toBeNull(); const assertHelperText = (text) => expect(getByText(wrapper.element, text)).not.toBeNull();
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -89,7 +89,7 @@ describe('DevopsAdoptionSegmentModal', () => { ...@@ -89,7 +89,7 @@ describe('DevopsAdoptionSegmentModal', () => {
describe('displays the correct content', () => { describe('displays the correct content', () => {
beforeEach(() => createComponent()); beforeEach(() => createComponent());
const isCorrectShape = option => { const isCorrectShape = (option) => {
const keys = Object.keys(option); const keys = Object.keys(option);
return keys.includes('label') && keys.includes('value'); return keys.includes('label') && keys.includes('value');
}; };
......
...@@ -5,7 +5,7 @@ import DevopsAdoptionTableCellFlag from 'ee/admin/dev_ops_report/components/devo ...@@ -5,7 +5,7 @@ import DevopsAdoptionTableCellFlag from 'ee/admin/dev_ops_report/components/devo
describe('DevopsAdoptionTableCellFlag', () => { describe('DevopsAdoptionTableCellFlag', () => {
let wrapper; let wrapper;
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(DevopsAdoptionTableCellFlag, { wrapper = shallowMount(DevopsAdoptionTableCellFlag, {
propsData: { propsData: {
enabled: true, enabled: true,
......
...@@ -31,7 +31,7 @@ describe('DevopsAdoptionTable', () => { ...@@ -31,7 +31,7 @@ describe('DevopsAdoptionTable', () => {
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.find(GlTable);
const findCol = testId => findTable().find(`[data-testid="${testId}"]`); const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`);
const findColRowChild = (col, row, child) => const findColRowChild = (col, row, child) =>
findTable().findAll(`[data-testid="${col}"]`).at(row).find(child); findTable().findAll(`[data-testid="${col}"]`).at(row).find(child);
......
...@@ -55,7 +55,7 @@ describe('CodeReviewAnalyticsApp component', () => { ...@@ -55,7 +55,7 @@ describe('CodeReviewAnalyticsApp component', () => {
}, },
}); });
const createComponent = store => const createComponent = (store) =>
shallowMount(CodeReviewAnalyticsApp, { shallowMount(CodeReviewAnalyticsApp, {
localVue, localVue,
store, store,
......
...@@ -102,10 +102,10 @@ describe('Filter bar', () => { ...@@ -102,10 +102,10 @@ describe('Filter bar', () => {
}); });
const findFilteredSearch = () => wrapper.find(FilteredSearchBar); const findFilteredSearch = () => wrapper.find(FilteredSearchBar);
const getSearchToken = type => const getSearchToken = (type) =>
findFilteredSearch() findFilteredSearch()
.props('tokens') .props('tokens')
.find(token => token.type === type); .find((token) => token.type === type);
describe('default', () => { describe('default', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -25,13 +25,13 @@ describe('MergeRequestTable component', () => { ...@@ -25,13 +25,13 @@ describe('MergeRequestTable component', () => {
}, },
}); });
const createComponent = store => const createComponent = (store) =>
mount(MergeRequestTable, { mount(MergeRequestTable, {
localVue, localVue,
store, store,
}); });
const bootstrap = initialState => { const bootstrap = (initialState) => {
vuexStore = createStore(initialState); vuexStore = createStore(initialState);
wrapper = createComponent(vuexStore); wrapper = createComponent(vuexStore);
}; };
...@@ -41,8 +41,8 @@ describe('MergeRequestTable component', () => { ...@@ -41,8 +41,8 @@ describe('MergeRequestTable component', () => {
}); });
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.find(GlTable);
const findTableRow = index => findTable().findAll('tbody tr').at(index); const findTableRow = (index) => findTable().findAll('tbody tr').at(index);
const findReviewTimeCol = rowIndex => findTableRow(rowIndex).findAll('td').at(1); const findReviewTimeCol = (rowIndex) => findTableRow(rowIndex).findAll('td').at(1);
const updateMergeRequests = (index, attrs) => const updateMergeRequests = (index, attrs) =>
mockMergeRequests.map((item, idx) => { mockMergeRequests.map((item, idx) => {
......
...@@ -91,7 +91,7 @@ describe('Code review analytics mergeRequests actions', () => { ...@@ -91,7 +91,7 @@ describe('Code review analytics mergeRequests actions', () => {
mock.onGet(/api\/(.*)\/analytics\/code_review/).replyOnce(500); mock.onGet(/api\/(.*)\/analytics\/code_review/).replyOnce(500);
}); });
it('dispatches error', done => { it('dispatches error', (done) => {
testAction( testAction(
actions.fetchMergeRequests, actions.fetchMergeRequests,
null, null,
......
...@@ -152,48 +152,48 @@ describe('Value Stream Analytics component', () => { ...@@ -152,48 +152,48 @@ describe('Value Stream Analytics component', () => {
return comp; return comp;
} }
const findStageNavItemAtIndex = index => const findStageNavItemAtIndex = (index) =>
wrapper.find(StageTableNav).findAll(StageNavItem).at(index); wrapper.find(StageTableNav).findAll(StageNavItem).at(index);
const findAddStageButton = () => wrapper.find(AddStageButton); const findAddStageButton = () => wrapper.find(AddStageButton);
const displaysProjectsDropdownFilter = flag => { const displaysProjectsDropdownFilter = (flag) => {
expect(wrapper.find(ProjectsDropdownFilter).exists()).toBe(flag); expect(wrapper.find(ProjectsDropdownFilter).exists()).toBe(flag);
}; };
const displaysDateRangePicker = flag => { const displaysDateRangePicker = (flag) => {
expect(wrapper.find(Daterange).exists()).toBe(flag); expect(wrapper.find(Daterange).exists()).toBe(flag);
}; };
const displaysMetrics = flag => { const displaysMetrics = (flag) => {
expect(wrapper.find(Metrics).exists()).toBe(flag); expect(wrapper.find(Metrics).exists()).toBe(flag);
}; };
const displaysStageTable = flag => { const displaysStageTable = (flag) => {
expect(wrapper.find(StageTable).exists()).toBe(flag); expect(wrapper.find(StageTable).exists()).toBe(flag);
}; };
const displaysDurationChart = flag => { const displaysDurationChart = (flag) => {
expect(wrapper.find(DurationChart).exists()).toBe(flag); expect(wrapper.find(DurationChart).exists()).toBe(flag);
}; };
const displaysTypeOfWork = flag => { const displaysTypeOfWork = (flag) => {
expect(wrapper.find(TypeOfWorkCharts).exists()).toBe(flag); expect(wrapper.find(TypeOfWorkCharts).exists()).toBe(flag);
}; };
const displaysPathNavigation = flag => { const displaysPathNavigation = (flag) => {
expect(wrapper.find(PathNavigation).exists()).toBe(flag); expect(wrapper.find(PathNavigation).exists()).toBe(flag);
}; };
const displaysAddStageButton = flag => { const displaysAddStageButton = (flag) => {
expect(wrapper.find(AddStageButton).exists()).toBe(flag); expect(wrapper.find(AddStageButton).exists()).toBe(flag);
}; };
const displaysFilterBar = flag => { const displaysFilterBar = (flag) => {
expect(wrapper.find(FilterBar).exists()).toBe(flag); expect(wrapper.find(FilterBar).exists()).toBe(flag);
}; };
const displaysValueStreamSelect = flag => { const displaysValueStreamSelect = (flag) => {
expect(wrapper.find(ValueStreamSelect).exists()).toBe(flag); expect(wrapper.find(ValueStreamSelect).exists()).toBe(flag);
}; };
...@@ -548,7 +548,7 @@ describe('Value Stream Analytics component', () => { ...@@ -548,7 +548,7 @@ describe('Value Stream Analytics component', () => {
}); });
const findFlashError = () => document.querySelector('.flash-container .flash-text'); const findFlashError = () => document.querySelector('.flash-container .flash-text');
const findError = async msg => { const findError = async (msg) => {
await waitForPromises(); await waitForPromises();
expect(findFlashError().innerText.trim()).toEqual(msg); expect(findFlashError().innerText.trim()).toEqual(msg);
}; };
......
...@@ -12,17 +12,17 @@ import { ...@@ -12,17 +12,17 @@ import {
customStageStopEvents as endEvents, customStageStopEvents as endEvents,
} from '../../mock_data'; } from '../../mock_data';
const formatStartEventOpts = _events => [ const formatStartEventOpts = (_events) => [
{ text: 'Select start event', value: null }, { text: 'Select start event', value: null },
..._events ..._events
.filter(ev => ev.canBeStartEvent) .filter((ev) => ev.canBeStartEvent)
.map(({ name: text, identifier: value }) => ({ text, value })), .map(({ name: text, identifier: value }) => ({ text, value })),
]; ];
const formatEndEventOpts = _events => [ const formatEndEventOpts = (_events) => [
{ text: 'Select end event', value: null }, { text: 'Select end event', value: null },
..._events ..._events
.filter(ev => !ev.canBeStartEvent) .filter((ev) => !ev.canBeStartEvent)
.map(({ name: text, identifier: value }) => ({ text, value })), .map(({ name: text, identifier: value }) => ({ text, value })),
]; ];
...@@ -54,8 +54,8 @@ describe('CustomStageFields', () => { ...@@ -54,8 +54,8 @@ describe('CustomStageFields', () => {
let wrapper = null; let wrapper = null;
const getSelectField = dropdownEl => dropdownEl.find(GlFormSelect); const getSelectField = (dropdownEl) => dropdownEl.find(GlFormSelect);
const getLabelSelect = dropdownEl => dropdownEl.find(LabelsSelector); const getLabelSelect = (dropdownEl) => dropdownEl.find(LabelsSelector);
const findName = () => wrapper.find('[data-testid="custom-stage-name"]'); const findName = () => wrapper.find('[data-testid="custom-stage-name"]');
const findStartEvent = () => wrapper.find('[data-testid="custom-stage-start-event"]'); const findStartEvent = () => wrapper.find('[data-testid="custom-stage-start-event"]');
...@@ -144,7 +144,7 @@ describe('CustomStageFields', () => { ...@@ -144,7 +144,7 @@ describe('CustomStageFields', () => {
}); });
describe('End event', () => { describe('End event', () => {
const possibleEndEvents = endEvents.filter(ev => const possibleEndEvents = endEvents.filter((ev) =>
labelStartEvent.allowedEndEvents.includes(ev.identifier), labelStartEvent.allowedEndEvents.includes(ev.identifier),
); );
......
...@@ -71,14 +71,14 @@ describe('CustomStageForm', () => { ...@@ -71,14 +71,14 @@ describe('CustomStageForm', () => {
let wrapper = null; let wrapper = null;
let mock; let mock;
const findEvent = ev => wrapper.emitted()[ev]; const findEvent = (ev) => wrapper.emitted()[ev];
const findSubmitButton = () => wrapper.find('[data-testid="save-custom-stage"]'); const findSubmitButton = () => wrapper.find('[data-testid="save-custom-stage"]');
const findCancelButton = () => wrapper.find('[data-testid="cancel-custom-stage"]'); const findCancelButton = () => wrapper.find('[data-testid="cancel-custom-stage"]');
const findRecoverStageDropdown = () => const findRecoverStageDropdown = () =>
wrapper.find('[data-testid="recover-hidden-stage-dropdown"]'); wrapper.find('[data-testid="recover-hidden-stage-dropdown"]');
const findFieldErrors = field => wrapper.vm.errors[field]; const findFieldErrors = (field) => wrapper.vm.errors[field];
const setFields = async (fields = minimumFields) => { const setFields = async (fields = minimumFields) => {
Object.entries(fields).forEach(([field, value]) => { Object.entries(fields).forEach(([field, value]) => {
......
...@@ -59,10 +59,10 @@ function createComponent({ ...@@ -59,10 +59,10 @@ function createComponent({
describe('DurationChart', () => { describe('DurationChart', () => {
let wrapper; let wrapper;
const findContainer = _wrapper => _wrapper.find('[data-testid="vsa-duration-chart"]'); const findContainer = (_wrapper) => _wrapper.find('[data-testid="vsa-duration-chart"]');
const findScatterPlot = _wrapper => _wrapper.find(Scatterplot); const findScatterPlot = (_wrapper) => _wrapper.find(Scatterplot);
const findStageDropdown = _wrapper => _wrapper.find(StageDropdownFilter); const findStageDropdown = (_wrapper) => _wrapper.find(StageDropdownFilter);
const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader); const findLoader = (_wrapper) => _wrapper.find(ChartSkeletonLoader);
const selectStage = (_wrapper, index = 0) => { const selectStage = (_wrapper, index = 0) => {
findStageDropdown(_wrapper).findAll(GlDropdownItem).at(index).vm.$emit('click'); findStageDropdown(_wrapper).findAll(GlDropdownItem).at(index).vm.$emit('click');
......
...@@ -75,7 +75,7 @@ describe('Filter bar', () => { ...@@ -75,7 +75,7 @@ describe('Filter bar', () => {
}); });
}; };
const createComponent = initialStore => { const createComponent = (initialStore) => {
return shallowMount(FilterBar, { return shallowMount(FilterBar, {
localVue, localVue,
store: initialStore, store: initialStore,
...@@ -101,10 +101,10 @@ describe('Filter bar', () => { ...@@ -101,10 +101,10 @@ describe('Filter bar', () => {
const selectedLabelList = [filterLabels[0]]; const selectedLabelList = [filterLabels[0]];
const findFilteredSearch = () => wrapper.find(FilteredSearchBar); const findFilteredSearch = () => wrapper.find(FilteredSearchBar);
const getSearchToken = type => const getSearchToken = (type) =>
findFilteredSearch() findFilteredSearch()
.props('tokens') .props('tokens')
.find(token => token.type === type); .find((token) => token.type === type);
describe('default', () => { describe('default', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -10,10 +10,10 @@ import waitForPromises from 'helpers/wait_for_promises'; ...@@ -10,10 +10,10 @@ import waitForPromises from 'helpers/wait_for_promises';
import { groupLabels } from '../mock_data'; import { groupLabels } from '../mock_data';
const selectedLabel = groupLabels[groupLabels.length - 1]; const selectedLabel = groupLabels[groupLabels.length - 1];
const findActiveItem = wrapper => const findActiveItem = (wrapper) =>
wrapper wrapper
.findAll('gl-dropdown-item-stub') .findAll('gl-dropdown-item-stub')
.filter(d => d.attributes('active')) .filter((d) => d.attributes('active'))
.at(0); .at(0);
const findFlashError = () => document.querySelector('.flash-container .flash-text'); const findFlashError = () => document.querySelector('.flash-container .flash-text');
...@@ -66,7 +66,7 @@ describe('Value Stream Analytics LabelsSelector', () => { ...@@ -66,7 +66,7 @@ describe('Value Stream Analytics LabelsSelector', () => {
expect(wrapper.html()).toMatchSnapshot(); expect(wrapper.html()).toMatchSnapshot();
}); });
it.each(labelNames)('generate a label item for the label %s', name => { it.each(labelNames)('generate a label item for the label %s', (name) => {
expect(wrapper.text()).toContain(name); expect(wrapper.text()).toContain(name);
}); });
......
...@@ -25,7 +25,7 @@ describe('Metrics', () => { ...@@ -25,7 +25,7 @@ describe('Metrics', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findTimeMetricsAtIndex = index => wrapper.findAll(TimeMetricsCard).at(index); const findTimeMetricsAtIndex = (index) => wrapper.findAll(TimeMetricsCard).at(index);
it.each` it.each`
metric | index | requestType metric | index | requestType
......
...@@ -6,7 +6,7 @@ import { transformedStagePathData, issueStage } from '../mock_data'; ...@@ -6,7 +6,7 @@ import { transformedStagePathData, issueStage } from '../mock_data';
describe('PathNavigation', () => { describe('PathNavigation', () => {
let wrapper = null; let wrapper = null;
const createComponent = props => { const createComponent = (props) => {
return mount(Component, { return mount(Component, {
propsData: { propsData: {
stages: transformedStagePathData, stages: transformedStagePathData,
...@@ -21,7 +21,7 @@ describe('PathNavigation', () => { ...@@ -21,7 +21,7 @@ describe('PathNavigation', () => {
return wrapper.findAll('.gl-path-button'); return wrapper.findAll('.gl-path-button');
}; };
const clickItemAt = index => { const clickItemAt = (index) => {
pathNavigationItems().at(index).trigger('click'); pathNavigationItems().at(index).trigger('click');
}; };
...@@ -42,7 +42,7 @@ describe('PathNavigation', () => { ...@@ -42,7 +42,7 @@ describe('PathNavigation', () => {
it('contains all the expected stages', () => { it('contains all the expected stages', () => {
const html = wrapper.find(GlPath).html(); const html = wrapper.find(GlPath).html();
transformedStagePathData.forEach(stage => { transformedStagePathData.forEach((stage) => {
expect(html).toContain(stage.title); expect(html).toContain(stage.title);
}); });
}); });
......
...@@ -38,7 +38,7 @@ describe('StageDropdownFilter component', () => { ...@@ -38,7 +38,7 @@ describe('StageDropdownFilter component', () => {
}); });
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.find(GlDropdown);
const selectDropdownItemAtIndex = index => const selectDropdownItemAtIndex = (index) =>
findDropdown().findAll(GlDropdownItem).at(index).vm.$emit('click'); findDropdown().findAll(GlDropdownItem).at(index).vm.$emit('click');
describe('on stage click', () => { describe('on stage click', () => {
......
...@@ -18,7 +18,7 @@ import { ...@@ -18,7 +18,7 @@ import {
codeEvents, codeEvents,
} from '../mock_data'; } from '../mock_data';
const generateEvents = n => const generateEvents = (n) =>
Array(n) Array(n)
.fill(issueEvents[0]) .fill(issueEvents[0])
.map((ev, k) => ({ ...ev, title: `event-${k}`, id: k })); .map((ev, k) => ({ ...ev, title: `event-${k}`, id: k }));
......
...@@ -29,7 +29,7 @@ describe('StageNavItem', () => { ...@@ -29,7 +29,7 @@ describe('StageNavItem', () => {
const findStageTooltip = () => getBinding(findStageTitle().element, 'gl-tooltip'); const findStageTooltip = () => getBinding(findStageTitle().element, 'gl-tooltip');
const findStageMedian = () => wrapper.find({ ref: 'median' }); const findStageMedian = () => wrapper.find({ ref: 'median' });
const findDropdown = () => wrapper.find({ ref: 'dropdown' }); const findDropdown = () => wrapper.find({ ref: 'dropdown' });
const setFakeTitleWidth = value => const setFakeTitleWidth = (value) =>
Object.defineProperty(findStageTitle().element, 'scrollWidth', { Object.defineProperty(findStageTitle().element, 'scrollWidth', {
value, value,
}); });
......
...@@ -65,7 +65,7 @@ describe('StageTable', () => { ...@@ -65,7 +65,7 @@ describe('StageTable', () => {
expect(renderedHeaders).toHaveLength(headers.length); expect(renderedHeaders).toHaveLength(headers.length);
const headerText = wrapper.find($sel.headersList).text(); const headerText = wrapper.find($sel.headersList).text();
headers.forEach(title => { headers.forEach((title) => {
expect(headerText).toContain(title); expect(headerText).toContain(title);
}); });
}); });
...@@ -85,7 +85,7 @@ describe('StageTable', () => { ...@@ -85,7 +85,7 @@ describe('StageTable', () => {
expect(evs).toHaveLength(allowedStages.length); expect(evs).toHaveLength(allowedStages.length);
const nav = wrapper.find($sel.nav).html(); const nav = wrapper.find($sel.nav).html();
allowedStages.forEach(stage => { allowedStages.forEach((stage) => {
expect(nav).toContain(stage.title); expect(nav).toContain(stage.title);
}); });
}); });
...@@ -105,7 +105,7 @@ describe('StageTable', () => { ...@@ -105,7 +105,7 @@ describe('StageTable', () => {
expect(evs).toHaveLength(issueEvents.length); expect(evs).toHaveLength(issueEvents.length);
const evshtml = wrapper.find($sel.eventList).html(); const evshtml = wrapper.find($sel.eventList).html();
issueEvents.forEach(ev => { issueEvents.forEach((ev) => {
expect(evshtml).toContain(ev.title); expect(evshtml).toContain(ev.title);
}); });
}); });
...@@ -128,7 +128,7 @@ describe('StageTable', () => { ...@@ -128,7 +128,7 @@ describe('StageTable', () => {
it('will render the list of stages', () => { it('will render the list of stages', () => {
const navEl = wrapper.find($sel.nav).element; const navEl = wrapper.find($sel.nav).element;
allowedStages.forEach(stage => { allowedStages.forEach((stage) => {
expect(getByText(navEl, stage.title, { selector: 'li' })).not.toBe(null); expect(getByText(navEl, stage.title, { selector: 'li' })).not.toBe(null);
}); });
}); });
......
...@@ -18,9 +18,9 @@ import { groupLabels } from '../../mock_data'; ...@@ -18,9 +18,9 @@ import { groupLabels } from '../../mock_data';
const selectedLabelIds = [groupLabels[0].id]; const selectedLabelIds = [groupLabels[0].id];
const findSubjectFilters = ctx => ctx.find(GlSegmentedControl); const findSubjectFilters = (ctx) => ctx.find(GlSegmentedControl);
const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('checked'); const findSelectedSubjectFilters = (ctx) => findSubjectFilters(ctx).attributes('checked');
const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDropdownItem); const findDropdownLabels = (ctx) => ctx.find(LabelsSelector).findAll(GlDropdownItem);
const selectLabelAtIndex = (ctx, index) => { const selectLabelAtIndex = (ctx, index) => {
findDropdownLabels(ctx).at(index).trigger('click'); findDropdownLabels(ctx).at(index).trigger('click');
......
...@@ -51,9 +51,9 @@ describe('TypeOfWorkCharts', () => { ...@@ -51,9 +51,9 @@ describe('TypeOfWorkCharts', () => {
let wrapper = null; let wrapper = null;
const findSubjectFilters = _wrapper => _wrapper.find(TasksByTypeFilters); const findSubjectFilters = (_wrapper) => _wrapper.find(TasksByTypeFilters);
const findTasksByTypeChart = _wrapper => _wrapper.find(TasksByTypeChart); const findTasksByTypeChart = (_wrapper) => _wrapper.find(TasksByTypeChart);
const findLoader = _wrapper => _wrapper.find(ChartSkeletonLoader); const findLoader = (_wrapper) => _wrapper.find(ChartSkeletonLoader);
const selectedFilterText = const selectedFilterText =
"Type of work Showing data for group 'Gitlab Org' from Dec 11, 2019 to Jan 10, 2020"; "Type of work Showing data for group 'Gitlab Org' from Dec 11, 2019 to Jan 10, 2020";
......
...@@ -52,10 +52,10 @@ describe('ValueStreamSelect', () => { ...@@ -52,10 +52,10 @@ describe('ValueStreamSelect', () => {
}, },
}); });
const findModal = modal => wrapper.find(`[data-testid="${modal}-value-stream-modal"]`); const findModal = (modal) => wrapper.find(`[data-testid="${modal}-value-stream-modal"]`);
const submitModal = modal => findModal(modal).vm.$emit('primary', mockEvent); const submitModal = (modal) => findModal(modal).vm.$emit('primary', mockEvent);
const findSelectValueStreamDropdown = () => wrapper.find(GlDropdown); const findSelectValueStreamDropdown = () => wrapper.find(GlDropdown);
const findSelectValueStreamDropdownOptions = _wrapper => findDropdownItemText(_wrapper); const findSelectValueStreamDropdownOptions = (_wrapper) => findDropdownItemText(_wrapper);
const findCreateValueStreamButton = () => wrapper.find(GlButton); const findCreateValueStreamButton = () => wrapper.find(GlButton);
const findDeleteValueStreamButton = () => wrapper.find('[data-testid="delete-value-stream"]'); const findDeleteValueStreamButton = () => wrapper.find('[data-testid="delete-value-stream"]');
...@@ -82,7 +82,7 @@ describe('ValueStreamSelect', () => { ...@@ -82,7 +82,7 @@ describe('ValueStreamSelect', () => {
it('renders each value stream including a create button', () => { it('renders each value stream including a create button', () => {
const opts = findSelectValueStreamDropdownOptions(wrapper); const opts = findSelectValueStreamDropdownOptions(wrapper);
[...valueStreams.map(v => v.name), 'Create new Value Stream'].forEach(vs => { [...valueStreams.map((v) => v.name), 'Create new Value Stream'].forEach((vs) => {
expect(opts).toContain(vs); expect(opts).toContain(vs);
}); });
}); });
......
...@@ -19,10 +19,10 @@ export function renderTotalTime(selector, element, totalTime = {}) { ...@@ -19,10 +19,10 @@ export function renderTotalTime(selector, element, totalTime = {}) {
export const shouldFlashAMessage = (msg = '') => export const shouldFlashAMessage = (msg = '') =>
expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(msg); expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe(msg);
export const findDropdownItems = wrapper => wrapper.findAll(GlDropdownItem); export const findDropdownItems = (wrapper) => wrapper.findAll(GlDropdownItem);
export const findDropdownItemText = wrapper => export const findDropdownItemText = (wrapper) =>
findDropdownItems(wrapper).wrappers.map(w => w.text()); findDropdownItems(wrapper).wrappers.map((w) => w.text());
export default { export default {
renderTotalTime, renderTotalTime,
......
...@@ -18,8 +18,8 @@ import { getDateInPast, getDatesInRange } from '~/lib/utils/datetime_utility'; ...@@ -18,8 +18,8 @@ import { getDateInPast, getDatesInRange } from '~/lib/utils/datetime_utility';
const fixtureEndpoints = { const fixtureEndpoints = {
customizableCycleAnalyticsStagesAndEvents: 'analytics/value_stream_analytics/stages.json', // customizable stages and events endpoint customizableCycleAnalyticsStagesAndEvents: 'analytics/value_stream_analytics/stages.json', // customizable stages and events endpoint
stageEvents: stage => `analytics/value_stream_analytics/stages/${stage}/records.json`, stageEvents: (stage) => `analytics/value_stream_analytics/stages/${stage}/records.json`,
stageMedian: stage => `analytics/value_stream_analytics/stages/${stage}/median.json`, stageMedian: (stage) => `analytics/value_stream_analytics/stages/${stage}/median.json`,
recentActivityData: 'analytics/metrics/value_stream_analytics/summary.json', recentActivityData: 'analytics/metrics/value_stream_analytics/summary.json',
timeMetricsData: 'analytics/metrics/value_stream_analytics/time_summary.json', timeMetricsData: 'analytics/metrics/value_stream_analytics/time_summary.json',
groupLabels: 'api/group_labels.json', groupLabels: 'api/group_labels.json',
...@@ -58,7 +58,7 @@ export const group = { ...@@ -58,7 +58,7 @@ export const group = {
export const currentGroup = convertObjectPropsToCamelCase(group, { deep: true }); export const currentGroup = convertObjectPropsToCamelCase(group, { deep: true });
const getStageByTitle = (stages, title) => const getStageByTitle = (stages, title) =>
stages.find(stage => stage.title && stage.title.toLowerCase().trim() === title) || {}; stages.find((stage) => stage.title && stage.title.toLowerCase().trim() === title) || {};
export const recentActivityData = getJSONFixture(fixtureEndpoints.recentActivityData); export const recentActivityData = getJSONFixture(fixtureEndpoints.recentActivityData);
export const timeMetricsData = getJSONFixture(fixtureEndpoints.timeMetricsData); export const timeMetricsData = getJSONFixture(fixtureEndpoints.timeMetricsData);
...@@ -81,7 +81,7 @@ export const stagingStage = getStageByTitle(dummyState.stages, 'staging'); ...@@ -81,7 +81,7 @@ export const stagingStage = getStageByTitle(dummyState.stages, 'staging');
export const allowedStages = [issueStage, planStage, codeStage]; export const allowedStages = [issueStage, planStage, codeStage];
const deepCamelCase = obj => convertObjectPropsToCamelCase(obj, { deep: true }); const deepCamelCase = (obj) => convertObjectPropsToCamelCase(obj, { deep: true });
export const defaultStages = ['issue', 'plan', 'review', 'code', 'test', 'staging']; export const defaultStages = ['issue', 'plan', 'review', 'code', 'test', 'staging'];
...@@ -135,24 +135,24 @@ export const medians = stageMedians; ...@@ -135,24 +135,24 @@ export const medians = stageMedians;
export const rawCustomStageEvents = customizableStagesAndEvents.events; export const rawCustomStageEvents = customizableStagesAndEvents.events;
export const camelCasedStageEvents = rawCustomStageEvents.map(deepCamelCase); export const camelCasedStageEvents = rawCustomStageEvents.map(deepCamelCase);
export const customStageLabelEvents = camelCasedStageEvents.filter(ev => ev.type === 'label'); export const customStageLabelEvents = camelCasedStageEvents.filter((ev) => ev.type === 'label');
export const customStageStartEvents = camelCasedStageEvents.filter(ev => ev.canBeStartEvent); export const customStageStartEvents = camelCasedStageEvents.filter((ev) => ev.canBeStartEvent);
// get all the possible stop events // get all the possible stop events
const allowedEndEventIds = new Set(customStageStartEvents.flatMap(e => e.allowedEndEvents)); const allowedEndEventIds = new Set(customStageStartEvents.flatMap((e) => e.allowedEndEvents));
export const customStageStopEvents = camelCasedStageEvents.filter(ev => export const customStageStopEvents = camelCasedStageEvents.filter((ev) =>
allowedEndEventIds.has(ev.identifier), allowedEndEventIds.has(ev.identifier),
); );
export const customStageEvents = uniq( export const customStageEvents = uniq(
[...customStageStartEvents, ...customStageStopEvents], [...customStageStartEvents, ...customStageStopEvents],
false, false,
ev => ev.identifier, (ev) => ev.identifier,
); );
export const labelStartEvent = customStageLabelEvents[0]; export const labelStartEvent = customStageLabelEvents[0];
export const labelStopEvent = customStageLabelEvents.find( export const labelStopEvent = customStageLabelEvents.find(
ev => ev.identifier === labelStartEvent.allowedEndEvents[0], (ev) => ev.identifier === labelStartEvent.allowedEndEvents[0],
); );
export const rawCustomStageFormErrors = { export const rawCustomStageFormErrors = {
...@@ -166,10 +166,10 @@ const dateRange = getDatesInRange(startDate, endDate, toYmd); ...@@ -166,10 +166,10 @@ const dateRange = getDatesInRange(startDate, endDate, toYmd);
export const apiTasksByTypeData = getJSONFixture( export const apiTasksByTypeData = getJSONFixture(
'analytics/charts/type_of_work/tasks_by_type.json', 'analytics/charts/type_of_work/tasks_by_type.json',
).map(labelData => { ).map((labelData) => {
// add data points for our mock date range // add data points for our mock date range
const maxValue = 10; const maxValue = 10;
const series = dateRange.map(date => [date, Math.floor(Math.random() * Math.floor(maxValue))]); const series = dateRange.map((date) => [date, Math.floor(Math.random() * Math.floor(maxValue))]);
return { return {
...labelData, ...labelData,
series, series,
......
...@@ -80,7 +80,7 @@ describe('Value Stream Analytics getters', () => { ...@@ -80,7 +80,7 @@ describe('Value Stream Analytics getters', () => {
}); });
describe('without a currentGroup set', () => { describe('without a currentGroup set', () => {
it.each([[''], [{}], [null]])('given "%s" will return null', value => { it.each([[''], [{}], [null]])('given "%s" will return null', (value) => {
state = { currentGroup: value }; state = { currentGroup: value };
expect(getters.currentGroupPath(state)).toEqual(null); expect(getters.currentGroupPath(state)).toEqual(null);
}); });
......
...@@ -130,7 +130,7 @@ describe('Value Stream Analytics mutations', () => { ...@@ -130,7 +130,7 @@ describe('Value Stream Analytics mutations', () => {
}); });
it('will convert the stats object to stages', () => { it('will convert the stats object to stages', () => {
[issueStage, planStage, codeStage, stagingStage, reviewStage].forEach(stage => { [issueStage, planStage, codeStage, stagingStage, reviewStage].forEach((stage) => {
expect(state.stages).toContainEqual(stage); expect(state.stages).toContainEqual(stage);
}); });
}); });
......
...@@ -39,7 +39,7 @@ import { ...@@ -39,7 +39,7 @@ import {
timeMetricsData, timeMetricsData,
} from './mock_data'; } from './mock_data';
const labelEventIds = labelEvents.map(ev => ev.identifier); const labelEventIds = labelEvents.map((ev) => ev.identifier);
describe('Value Stream Analytics utils', () => { describe('Value Stream Analytics utils', () => {
describe('isStartEvent', () => { describe('isStartEvent', () => {
...@@ -49,7 +49,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -49,7 +49,7 @@ describe('Value Stream Analytics utils', () => {
it('will return false for input that is not a start event', () => { it('will return false for input that is not a start event', () => {
[{ identifier: 'fake-event', canBeStartEvent: false }, {}, [], null, undefined].forEach( [{ identifier: 'fake-event', canBeStartEvent: false }, {}, [], null, undefined].forEach(
ev => { (ev) => {
expect(isStartEvent(ev)).toEqual(false); expect(isStartEvent(ev)).toEqual(false);
}, },
); );
...@@ -62,7 +62,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -62,7 +62,7 @@ describe('Value Stream Analytics utils', () => {
}); });
it('will return false if the given event identifier is not in the labelEvents array', () => { it('will return false if the given event identifier is not in the labelEvents array', () => {
[startEvents[1].identifier, null, undefined, ''].forEach(ev => { [startEvents[1].identifier, null, undefined, ''].forEach((ev) => {
expect(isLabelEvent(labelEventIds, ev)).toEqual(false); expect(isLabelEvent(labelEventIds, ev)).toEqual(false);
}); });
expect(isLabelEvent(labelEventIds)).toEqual(false); expect(isLabelEvent(labelEventIds)).toEqual(false);
...@@ -71,20 +71,20 @@ describe('Value Stream Analytics utils', () => { ...@@ -71,20 +71,20 @@ describe('Value Stream Analytics utils', () => {
describe('eventToOption', () => { describe('eventToOption', () => {
it('will return null if no valid object is passed in', () => { it('will return null if no valid object is passed in', () => {
[{}, [], null, undefined].forEach(i => { [{}, [], null, undefined].forEach((i) => {
expect(eventToOption(i)).toEqual(null); expect(eventToOption(i)).toEqual(null);
}); });
}); });
it('will set the "value" property to the events identifier', () => { it('will set the "value" property to the events identifier', () => {
events.forEach(ev => { events.forEach((ev) => {
const res = eventToOption(ev); const res = eventToOption(ev);
expect(res.value).toEqual(ev.identifier); expect(res.value).toEqual(ev.identifier);
}); });
}); });
it('will set the "text" property to the events name', () => { it('will set the "text" property to the events name', () => {
events.forEach(ev => { events.forEach((ev) => {
const res = eventToOption(ev); const res = eventToOption(ev);
expect(res.text).toEqual(ev.name); expect(res.text).toEqual(ev.name);
}); });
...@@ -111,7 +111,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -111,7 +111,7 @@ describe('Value Stream Analytics utils', () => {
}); });
it('will return an empty array if there are no end events available', () => { it('will return an empty array if there are no end events available', () => {
['cool_issue_label_added', [], {}, null, undefined].forEach(ev => { ['cool_issue_label_added', [], {}, null, undefined].forEach((ev) => {
expect(getAllowedEndEvents(events, ev)).toEqual([]); expect(getAllowedEndEvents(events, ev)).toEqual([]);
}); });
}); });
...@@ -123,7 +123,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -123,7 +123,7 @@ describe('Value Stream Analytics utils', () => {
}); });
it('will return an empty array if there are no matching events', () => { it('will return an empty array if there are no matching events', () => {
[['lol', 'bad'], [], {}, null, undefined].forEach(items => { [['lol', 'bad'], [], {}, null, undefined].forEach((items) => {
expect(eventsByIdentifier(events, items)).toEqual([]); expect(eventsByIdentifier(events, items)).toEqual([]);
}); });
expect(eventsByIdentifier([], labelEvents)).toEqual([]); expect(eventsByIdentifier([], labelEvents)).toEqual([]);
...@@ -162,14 +162,14 @@ describe('Value Stream Analytics utils', () => { ...@@ -162,14 +162,14 @@ describe('Value Stream Analytics utils', () => {
it('sets the slug to the value of the stage id', () => { it('sets the slug to the value of the stage id', () => {
const transformed = transformRawStages([issueStage, rawCustomStage]); const transformed = transformRawStages([issueStage, rawCustomStage]);
transformed.forEach(t => { transformed.forEach((t) => {
expect(t.slug).toEqual(t.id); expect(t.slug).toEqual(t.id);
}); });
}); });
it('sets the name to the value of the stage title if its not set', () => { it('sets the name to the value of the stage title if its not set', () => {
const transformed = transformRawStages([issueStage, rawCustomStage]); const transformed = transformRawStages([issueStage, rawCustomStage]);
transformed.forEach(t => { transformed.forEach((t) => {
expect(t.name.length > 0).toBe(true); expect(t.name.length > 0).toBe(true);
expect(t.name).toEqual(t.title); expect(t.name).toEqual(t.title);
}); });
...@@ -204,7 +204,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -204,7 +204,7 @@ describe('Value Stream Analytics utils', () => {
it('extracts the value from an array of datetime / value pairs', () => { it('extracts the value from an array of datetime / value pairs', () => {
expect(transformedDummySeries.every(isNumber)).toEqual(true); expect(transformedDummySeries.every(isNumber)).toEqual(true);
Object.values(dummySeries).forEach(v => { Object.values(dummySeries).forEach((v) => {
expect(transformedDummySeries.includes(v)).toBeTruthy(); expect(transformedDummySeries.includes(v)).toBeTruthy();
}); });
}); });
...@@ -232,21 +232,21 @@ describe('Value Stream Analytics utils', () => { ...@@ -232,21 +232,21 @@ describe('Value Stream Analytics utils', () => {
const extractSeriesValues = ({ label: { title: name }, series }) => { const extractSeriesValues = ({ label: { title: name }, series }) => {
return { return {
name, name,
data: series.map(kv => kv[1]), data: series.map((kv) => kv[1]),
}; };
}; };
const data = rawTasksByTypeData.map(extractSeriesValues); const data = rawTasksByTypeData.map(extractSeriesValues);
const labels = rawTasksByTypeData.map(d => { const labels = rawTasksByTypeData.map((d) => {
const { label } = d; const { label } = d;
return label.title; return label.title;
}); });
it('will return blank arrays if given no data', () => { it('will return blank arrays if given no data', () => {
[{ data: [], startDate, endDate }, [], {}].forEach(chartData => { [{ data: [], startDate, endDate }, [], {}].forEach((chartData) => {
transformed = getTasksByTypeData(chartData); transformed = getTasksByTypeData(chartData);
['data', 'groupBy'].forEach(key => { ['data', 'groupBy'].forEach((key) => {
expect(transformed[key]).toEqual([]); expect(transformed[key]).toEqual([]);
}); });
}); });
...@@ -258,7 +258,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -258,7 +258,7 @@ describe('Value Stream Analytics utils', () => {
}); });
it('will return an object with the properties needed for the chart', () => { it('will return an object with the properties needed for the chart', () => {
['data', 'groupBy'].forEach(key => { ['data', 'groupBy'].forEach((key) => {
expect(transformed).toHaveProperty(key); expect(transformed).toHaveProperty(key);
}); });
}); });
...@@ -287,7 +287,7 @@ describe('Value Stream Analytics utils', () => { ...@@ -287,7 +287,7 @@ describe('Value Stream Analytics utils', () => {
}); });
it('contains a value for each day in the groupBy', () => { it('contains a value for each day in the groupBy', () => {
transformed.data.forEach(d => { transformed.data.forEach((d) => {
expect(d.data).toHaveLength(transformed.groupBy.length); expect(d.data).toHaveLength(transformed.groupBy.length);
}); });
}); });
...@@ -326,13 +326,13 @@ describe('Value Stream Analytics utils', () => { ...@@ -326,13 +326,13 @@ describe('Value Stream Analytics utils', () => {
}); });
it('selects the correct stage', () => { it('selects the correct stage', () => {
const selected = response.filter(stage => stage.selected === true)[0]; const selected = response.filter((stage) => stage.selected === true)[0];
expect(selected.title).toEqual(issueStage.title); expect(selected.title).toEqual(issueStage.title);
}); });
it('includes the correct metric for the associated stage', () => { it('includes the correct metric for the associated stage', () => {
const issue = response.filter(stage => stage.name === 'Issue')[0]; const issue = response.filter((stage) => stage.name === 'Issue')[0];
expect(issue.metric).toEqual(pathNavIssueMetric); expect(issue.metric).toEqual(pathNavIssueMetric);
}); });
......
...@@ -125,10 +125,10 @@ describe('Filter bar', () => { ...@@ -125,10 +125,10 @@ describe('Filter bar', () => {
}); });
const findFilteredSearch = () => wrapper.find(FilteredSearchBar); const findFilteredSearch = () => wrapper.find(FilteredSearchBar);
const getSearchToken = type => const getSearchToken = (type) =>
findFilteredSearch() findFilteredSearch()
.props('tokens') .props('tokens')
.find(token => token.type === type); .find((token) => token.type === type);
describe('default', () => { describe('default', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -57,7 +57,7 @@ describe('ThroughputTable', () => { ...@@ -57,7 +57,7 @@ describe('ThroughputTable', () => {
expect(wrapper.find(component).exists()).toBe(visible); expect(wrapper.find(component).exists()).toBe(visible);
}; };
const additionalData = data => { const additionalData = (data) => {
wrapper.setData({ wrapper.setData({
throughputTableData: { throughputTableData: {
list: [{ ...throughputTableData[0], ...data }], list: [{ ...throughputTableData[0], ...data }],
...@@ -68,7 +68,7 @@ describe('ThroughputTable', () => { ...@@ -68,7 +68,7 @@ describe('ThroughputTable', () => {
const findTable = () => wrapper.find(GlTable); const findTable = () => wrapper.find(GlTable);
const findCol = testId => findTable().find(`[data-testid="${testId}"]`); const findCol = (testId) => findTable().find(`[data-testid="${testId}"]`);
const findColSubItem = (colTestId, childTetestId) => const findColSubItem = (colTestId, childTetestId) =>
findCol(colTestId).find(`[data-testid="${childTetestId}"]`); findCol(colTestId).find(`[data-testid="${childTetestId}"]`);
......
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