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