Commit b69f448f authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 66 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 52907ac2
...@@ -4,7 +4,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -4,7 +4,7 @@ import axios from '~/lib/utils/axios_utils';
import refreshCounts from '~/pages/search/show/refresh_counts'; import refreshCounts from '~/pages/search/show/refresh_counts';
const URL = `${TEST_HOST}/search/count?search=lorem+ipsum&project_id=3`; const URL = `${TEST_HOST}/search/count?search=lorem+ipsum&project_id=3`;
const urlWithScope = scope => `${URL}&scope=${scope}`; const urlWithScope = (scope) => `${URL}&scope=${scope}`;
const counts = [ const counts = [
{ scope: 'issues', count: 4 }, { scope: 'issues', count: 4 },
{ scope: 'merge_requests', count: 5 }, { scope: 'merge_requests', count: 5 },
......
...@@ -2,7 +2,7 @@ import $ from 'jquery'; ...@@ -2,7 +2,7 @@ import $ from 'jquery';
import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment'; import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment';
describe('preserve_url_fragment', () => { describe('preserve_url_fragment', () => {
const findFormAction = selector => { const findFormAction = (selector) => {
return $(`.omniauth-container ${selector}`).parent('form').attr('action'); return $(`.omniauth-container ${selector}`).parent('form').attr('action');
}; };
......
...@@ -56,7 +56,7 @@ describe('SigninTabsMemoizer', () => { ...@@ -56,7 +56,7 @@ describe('SigninTabsMemoizer', () => {
}; };
jest jest
.spyOn(document, 'querySelector') .spyOn(document, 'querySelector')
.mockImplementation(selector => .mockImplementation((selector) =>
selector === `${tabSelector} a[href="#bogus"]` ? null : fakeTab, selector === `${tabSelector} a[href="#bogus"]` ? null : fakeTab,
); );
......
...@@ -14,7 +14,7 @@ const Component = Vue.extend(PDFLab); ...@@ -14,7 +14,7 @@ const Component = Vue.extend(PDFLab);
describe('PDF component', () => { describe('PDF component', () => {
let vm; let vm;
const checkLoaded = done => { const checkLoaded = (done) => {
if (vm.loading) { if (vm.loading) {
setTimeout(() => { setTimeout(() => {
checkLoaded(done); checkLoaded(done);
...@@ -25,7 +25,7 @@ describe('PDF component', () => { ...@@ -25,7 +25,7 @@ describe('PDF component', () => {
}; };
describe('without PDF data', () => { describe('without PDF data', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
pdf: '', pdf: '',
...@@ -43,7 +43,7 @@ describe('PDF component', () => { ...@@ -43,7 +43,7 @@ describe('PDF component', () => {
}); });
describe('with PDF data', () => { describe('with PDF data', () => {
beforeEach(done => { beforeEach((done) => {
vm = new Component({ vm = new Component({
propsData: { propsData: {
pdf, pdf,
......
...@@ -14,7 +14,7 @@ describe('Page component', () => { ...@@ -14,7 +14,7 @@ describe('Page component', () => {
vm.$destroy(); vm.$destroy();
}); });
it('renders the page when mounting', done => { it('renders the page when mounting', (done) => {
const promise = Promise.resolve(); const promise = Promise.resolve();
const testPage = { const testPage = {
render: jest.fn().mockReturnValue({ promise: Promise.resolve() }), render: jest.fn().mockReturnValue({ promise: Promise.resolve() }),
......
...@@ -7,7 +7,7 @@ import RequestWarning from '~/performance_bar/components/request_warning.vue'; ...@@ -7,7 +7,7 @@ import RequestWarning from '~/performance_bar/components/request_warning.vue';
describe('detailedMetric', () => { describe('detailedMetric', () => {
let wrapper; let wrapper;
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(DetailedMetric, { wrapper = shallowMount(DetailedMetric, {
propsData: { propsData: {
...props, ...props,
...@@ -16,9 +16,9 @@ describe('detailedMetric', () => { ...@@ -16,9 +16,9 @@ describe('detailedMetric', () => {
}; };
const findAllTraceBlocks = () => wrapper.findAll('pre'); const findAllTraceBlocks = () => wrapper.findAll('pre');
const findTraceBlockAtIndex = index => findAllTraceBlocks().at(index); const findTraceBlockAtIndex = (index) => findAllTraceBlocks().at(index);
const findExpandBacktraceBtns = () => wrapper.findAll('[data-testid="backtrace-expand-btn"]'); const findExpandBacktraceBtns = () => wrapper.findAll('[data-testid="backtrace-expand-btn"]');
const findExpandedBacktraceBtnAtIndex = index => findExpandBacktraceBtns().at(index); const findExpandedBacktraceBtnAtIndex = (index) => findExpandBacktraceBtns().at(index);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -95,7 +95,7 @@ describe('detailedMetric', () => { ...@@ -95,7 +95,7 @@ describe('detailedMetric', () => {
expect(wrapper.find('.js-toggle-button')).not.toBeNull(); expect(wrapper.find('.js-toggle-button')).not.toBeNull();
wrapper.findAll('.performance-bar-modal td:nth-child(2)').wrappers.forEach(request => { wrapper.findAll('.performance-bar-modal td:nth-child(2)').wrappers.forEach((request) => {
expect(request.text()).toContain('world'); expect(request.text()).toContain('world');
}); });
}); });
......
...@@ -3,7 +3,7 @@ import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store' ...@@ -3,7 +3,7 @@ import PerformanceBarStore from '~/performance_bar/stores/performance_bar_store'
describe('PerformanceBarStore', () => { describe('PerformanceBarStore', () => {
describe('truncateUrl', () => { describe('truncateUrl', () => {
let store; let store;
const findUrl = id => store.findRequest(id).truncatedUrl; const findUrl = (id) => store.findRequest(id).truncatedUrl;
beforeEach(() => { beforeEach(() => {
store = new PerformanceBarStore(); store = new PerformanceBarStore();
......
...@@ -5,7 +5,7 @@ import { CI_CONFIG_STATUS_INVALID } from '~/pipeline_editor/constants'; ...@@ -5,7 +5,7 @@ import { CI_CONFIG_STATUS_INVALID } from '~/pipeline_editor/constants';
import { mockCiConfigQueryResponse, mockLintHelpPagePath } from '../../mock_data'; import { mockCiConfigQueryResponse, mockLintHelpPagePath } from '../../mock_data';
import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils'; import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils';
const getCiConfig = mergedConfig => { const getCiConfig = (mergedConfig) => {
const { ciConfig } = mockCiConfigQueryResponse.data; const { ciConfig } = mockCiConfigQueryResponse.data;
return { return {
...ciConfig, ...ciConfig,
...@@ -29,10 +29,10 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => { ...@@ -29,10 +29,10 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => {
}); });
}; };
const findAllByTestId = selector => wrapper.findAll(`[data-testid="${selector}"]`); const findAllByTestId = (selector) => wrapper.findAll(`[data-testid="${selector}"]`);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findLintParameters = () => findAllByTestId('ci-lint-parameter'); const findLintParameters = () => findAllByTestId('ci-lint-parameter');
const findLintParameterAt = i => findLintParameters().at(i); const findLintParameterAt = (i) => findLintParameters().at(i);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -139,7 +139,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -139,7 +139,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findTabAt = i => wrapper.findAll(GlTab).at(i); const findTabAt = (i) => wrapper.findAll(GlTab).at(i);
const findVisualizationTab = () => wrapper.find('[data-testid="visualization-tab"]'); const findVisualizationTab = () => wrapper.find('[data-testid="visualization-tab"]');
const findTextEditor = () => wrapper.find(TextEditor); const findTextEditor = () => wrapper.find(TextEditor);
const findEditorLite = () => wrapper.find(MockEditorLite); const findEditorLite = () => wrapper.find(MockEditorLite);
...@@ -255,7 +255,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -255,7 +255,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
startBranch: mockDefaultBranch, startBranch: mockDefaultBranch,
}; };
const findInForm = selector => findCommitForm().find(selector); const findInForm = (selector) => findCommitForm().find(selector);
const submitCommit = async ({ const submitCommit = async ({
message = mockCommitMessage, message = mockCommitMessage,
......
...@@ -44,7 +44,7 @@ describe('Pipeline New Form', () => { ...@@ -44,7 +44,7 @@ describe('Pipeline New Form', () => {
const findWarnings = () => wrapper.findAll('[data-testid="run-pipeline-warning"]'); const findWarnings = () => wrapper.findAll('[data-testid="run-pipeline-warning"]');
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const getExpectedPostParams = () => JSON.parse(mock.history.post[0].data); const getExpectedPostParams = () => JSON.parse(mock.history.post[0].data);
const changeRef = i => findDropdownItems().at(i).vm.$emit('click'); const changeRef = (i) => findDropdownItems().at(i).vm.$emit('click');
const createComponent = (term = '', props = {}, method = shallowMount) => { const createComponent = (term = '', props = {}, method = shallowMount) => {
wrapper = method(PipelineNewForm, { wrapper = method(PipelineNewForm, {
......
...@@ -94,7 +94,7 @@ describe('The DAG graph', () => { ...@@ -94,7 +94,7 @@ describe('The DAG graph', () => {
}); });
describe('interactions', () => { describe('interactions', () => {
const strokeOpacity = opacity => `stroke-opacity: ${opacity};`; const strokeOpacity = (opacity) => `stroke-opacity: ${opacity};`;
const baseOpacity = () => wrapper.vm.$options.viewOptions.baseOpacity; const baseOpacity = () => wrapper.vm.$options.viewOptions.baseOpacity;
describe('links', () => { describe('links', () => {
...@@ -164,10 +164,10 @@ describe('The DAG graph', () => { ...@@ -164,10 +164,10 @@ describe('The DAG graph', () => {
describe('nodes', () => { describe('nodes', () => {
const liveNode = () => getAllNodes().at(10); const liveNode = () => getAllNodes().at(10);
const anotherLiveNode = () => getAllNodes().at(5); const anotherLiveNode = () => getAllNodes().at(5);
const nodesNotHighlighted = () => getAllNodes().filter(n => !n.classes(IS_HIGHLIGHTED)); const nodesNotHighlighted = () => getAllNodes().filter((n) => !n.classes(IS_HIGHLIGHTED));
const linksNotHighlighted = () => getAllLinks().filter(n => !n.classes(IS_HIGHLIGHTED)); const linksNotHighlighted = () => getAllLinks().filter((n) => !n.classes(IS_HIGHLIGHTED));
const nodesHighlighted = () => getAllNodes().filter(n => n.classes(IS_HIGHLIGHTED)); const nodesHighlighted = () => getAllNodes().filter((n) => n.classes(IS_HIGHLIGHTED));
const linksHighlighted = () => getAllLinks().filter(n => n.classes(IS_HIGHLIGHTED)); const linksHighlighted = () => getAllLinks().filter((n) => n.classes(IS_HIGHLIGHTED));
describe('on click', () => { describe('on click', () => {
it('highlights the clicked node and predecessors', () => { it('highlights the clicked node and predecessors', () => {
...@@ -176,19 +176,19 @@ describe('The DAG graph', () => { ...@@ -176,19 +176,19 @@ describe('The DAG graph', () => {
expect(nodesNotHighlighted().length < getAllNodes().length).toBe(true); expect(nodesNotHighlighted().length < getAllNodes().length).toBe(true);
expect(linksNotHighlighted().length < getAllLinks().length).toBe(true); expect(linksNotHighlighted().length < getAllLinks().length).toBe(true);
linksHighlighted().wrappers.forEach(link => { linksHighlighted().wrappers.forEach((link) => {
expect(link.attributes('style')).toBe(strokeOpacity(highlightIn)); expect(link.attributes('style')).toBe(strokeOpacity(highlightIn));
}); });
nodesHighlighted().wrappers.forEach(node => { nodesHighlighted().wrappers.forEach((node) => {
expect(node.attributes('stroke')).not.toBe('#f2f2f2'); expect(node.attributes('stroke')).not.toBe('#f2f2f2');
}); });
linksNotHighlighted().wrappers.forEach(link => { linksNotHighlighted().wrappers.forEach((link) => {
expect(link.attributes('style')).toBe(strokeOpacity(highlightOut)); expect(link.attributes('style')).toBe(strokeOpacity(highlightOut));
}); });
nodesNotHighlighted().wrappers.forEach(node => { nodesNotHighlighted().wrappers.forEach((node) => {
expect(node.attributes('stroke')).toBe('#f2f2f2'); expect(node.attributes('stroke')).toBe('#f2f2f2');
}); });
}); });
......
...@@ -21,7 +21,7 @@ describe('Pipeline DAG graph wrapper', () => { ...@@ -21,7 +21,7 @@ describe('Pipeline DAG graph wrapper', () => {
const getAllAlerts = () => wrapper.findAll(GlAlert); const getAllAlerts = () => wrapper.findAll(GlAlert);
const getGraph = () => wrapper.find(DagGraph); const getGraph = () => wrapper.find(DagGraph);
const getNotes = () => wrapper.find(DagAnnotations); const getNotes = () => wrapper.find(DagAnnotations);
const getErrorText = type => wrapper.vm.$options.errorTexts[type]; const getErrorText = (type) => wrapper.vm.$options.errorTexts[type];
const getEmptyState = () => wrapper.find(GlEmptyState); const getEmptyState = () => wrapper.find(GlEmptyState);
const createComponent = ({ const createComponent = ({
......
...@@ -11,10 +11,10 @@ describe('Pipelines filtered search', () => { ...@@ -11,10 +11,10 @@ describe('Pipelines filtered search', () => {
let mock; let mock;
const findFilteredSearch = () => wrapper.find(GlFilteredSearch); const findFilteredSearch = () => wrapper.find(GlFilteredSearch);
const getSearchToken = type => const getSearchToken = (type) =>
findFilteredSearch() findFilteredSearch()
.props('availableTokens') .props('availableTokens')
.find(token => token.type === type); .find((token) => token.type === type);
const findBranchToken = () => getSearchToken('ref'); const findBranchToken = () => getSearchToken('ref');
const findTagToken = () => getSearchToken('tag'); const findTagToken = () => getSearchToken('tag');
const findUserToken = () => getSearchToken('username'); const findUserToken = () => getSearchToken('username');
......
...@@ -33,7 +33,7 @@ describe('pipeline graph action component', () => { ...@@ -33,7 +33,7 @@ describe('pipeline graph action component', () => {
expect(wrapper.attributes('title')).toBe('bar'); expect(wrapper.attributes('title')).toBe('bar');
}); });
it('should update bootstrap tooltip when title changes', done => { it('should update bootstrap tooltip when title changes', (done) => {
wrapper.setProps({ tooltipText: 'changed' }); wrapper.setProps({ tooltipText: 'changed' });
wrapper.vm wrapper.vm
...@@ -51,7 +51,7 @@ describe('pipeline graph action component', () => { ...@@ -51,7 +51,7 @@ describe('pipeline graph action component', () => {
}); });
describe('on click', () => { describe('on click', () => {
it('emits `pipelineActionRequestComplete` after a successful request', done => { it('emits `pipelineActionRequestComplete` after a successful request', (done) => {
jest.spyOn(wrapper.vm, '$emit'); jest.spyOn(wrapper.vm, '$emit');
findButton().trigger('click'); findButton().trigger('click');
...@@ -64,7 +64,7 @@ describe('pipeline graph action component', () => { ...@@ -64,7 +64,7 @@ describe('pipeline graph action component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('renders a loading icon while waiting for request', done => { it('renders a loading icon while waiting for request', (done) => {
findButton().trigger('click'); findButton().trigger('click');
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -18,7 +18,7 @@ describe('graph component', () => { ...@@ -18,7 +18,7 @@ describe('graph component', () => {
const findExpandPipelineBtn = () => wrapper.find('[data-testid="expand-pipeline-button"]'); const findExpandPipelineBtn = () => wrapper.find('[data-testid="expand-pipeline-button"]');
const findAllExpandPipelineBtns = () => wrapper.findAll('[data-testid="expand-pipeline-button"]'); const findAllExpandPipelineBtns = () => wrapper.findAll('[data-testid="expand-pipeline-button"]');
const findStageColumns = () => wrapper.findAll(StageColumnComponentLegacy); const findStageColumns = () => wrapper.findAll(StageColumnComponentLegacy);
const findStageColumnAt = i => findStageColumns().at(i); const findStageColumnAt = (i) => findStageColumns().at(i);
beforeEach(() => { beforeEach(() => {
mediator = new PipelinesMediator({ endpoint: '' }); mediator = new PipelinesMediator({ endpoint: '' });
...@@ -167,7 +167,7 @@ describe('graph component', () => { ...@@ -167,7 +167,7 @@ describe('graph component', () => {
}); });
describe('with expanded pipeline', () => { describe('with expanded pipeline', () => {
it('should render expanded pipeline', done => { it('should render expanded pipeline', (done) => {
// expand the pipeline // expand the pipeline
store.state.pipeline.triggered_by[0].isExpanded = true; store.state.pipeline.triggered_by[0].isExpanded = true;
...@@ -212,7 +212,7 @@ describe('graph component', () => { ...@@ -212,7 +212,7 @@ describe('graph component', () => {
}); });
describe('with expanded pipeline', () => { describe('with expanded pipeline', () => {
it('should render expanded pipeline', done => { it('should render expanded pipeline', (done) => {
// expand the pipeline // expand the pipeline
store.state.pipeline.triggered[0].isExpanded = true; store.state.pipeline.triggered[0].isExpanded = true;
......
...@@ -7,7 +7,7 @@ describe('pipeline graph job item', () => { ...@@ -7,7 +7,7 @@ describe('pipeline graph job item', () => {
const findJobWithoutLink = () => wrapper.find('[data-testid="job-without-link"]'); const findJobWithoutLink = () => wrapper.find('[data-testid="job-without-link"]');
const findJobWithLink = () => wrapper.find('[data-testid="job-with-link"]'); const findJobWithLink = () => wrapper.find('[data-testid="job-with-link"]');
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = mount(JobItem, { wrapper = mount(JobItem, {
propsData, propsData,
}); });
...@@ -52,7 +52,7 @@ describe('pipeline graph job item', () => { ...@@ -52,7 +52,7 @@ describe('pipeline graph job item', () => {
}); });
describe('name with link', () => { describe('name with link', () => {
it('should render the job name and status with a link', done => { it('should render the job name and status with a link', (done) => {
createWrapper({ job: mockJob }); createWrapper({ job: mockJob });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -656,7 +656,7 @@ export const wrappedPipelineReturn = { ...@@ -656,7 +656,7 @@ export const wrappedPipelineReturn = {
export const generateResponse = (raw, mockPath) => unwrapPipelineData(mockPath, raw.data); export const generateResponse = (raw, mockPath) => unwrapPipelineData(mockPath, raw.data);
export const pipelineWithUpstreamDownstream = base => { export const pipelineWithUpstreamDownstream = (base) => {
const pip = { ...base }; const pip = { ...base };
pip.data.project.pipeline.downstream = downstream; pip.data.project.pipeline.downstream = downstream;
pip.data.project.pipeline.upstream = upstream; pip.data.project.pipeline.upstream = upstream;
......
...@@ -23,7 +23,7 @@ describe('pipeline graph component', () => { ...@@ -23,7 +23,7 @@ describe('pipeline graph component', () => {
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findAllStagePills = () => wrapper.findAll(StagePill); const findAllStagePills = () => wrapper.findAll(StagePill);
const findAllStageBackgroundElements = () => wrapper.findAll('[data-testid="stage-background"]'); const findAllStageBackgroundElements = () => wrapper.findAll('[data-testid="stage-background"]');
const findStageBackgroundElementAt = index => findAllStageBackgroundElements().at(index); const findStageBackgroundElementAt = (index) => findAllStageBackgroundElements().at(index);
const findAllJobPills = () => wrapper.findAll(JobPill); const findAllJobPills = () => wrapper.findAll(JobPill);
afterEach(() => { afterEach(() => {
......
...@@ -28,7 +28,7 @@ describe('Pipeline Url Component', () => { ...@@ -28,7 +28,7 @@ describe('Pipeline Url Component', () => {
pipelineScheduleUrl: 'foo', pipelineScheduleUrl: 'foo',
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = shallowMount(PipelineUrlComponent, { wrapper = shallowMount(PipelineUrlComponent, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
provide: { provide: {
......
...@@ -57,10 +57,10 @@ describe('Pipelines', () => { ...@@ -57,10 +57,10 @@ describe('Pipelines', () => {
}; };
const findFilteredSearch = () => wrapper.find(GlFilteredSearch); const findFilteredSearch = () => wrapper.find(GlFilteredSearch);
const findByTestId = id => wrapper.find(`[data-testid="${id}"]`); const findByTestId = (id) => wrapper.find(`[data-testid="${id}"]`);
const findNavigationTabs = () => wrapper.find(NavigationTabs); const findNavigationTabs = () => wrapper.find(NavigationTabs);
const findNavigationControls = () => wrapper.find(NavigationControls); const findNavigationControls = () => wrapper.find(NavigationControls);
const findTab = tab => findByTestId(`pipelines-tab-${tab}`); const findTab = (tab) => findByTestId(`pipelines-tab-${tab}`);
const findRunPipelineButton = () => findByTestId('run-pipeline-button'); const findRunPipelineButton = () => findByTestId('run-pipeline-button');
const findCiLintButton = () => findByTestId('ci-lint-button'); const findCiLintButton = () => findByTestId('ci-lint-button');
......
...@@ -5,7 +5,7 @@ import eventHub from '~/pipelines/event_hub'; ...@@ -5,7 +5,7 @@ import eventHub from '~/pipelines/event_hub';
describe('Pipelines Table Row', () => { describe('Pipelines Table Row', () => {
const jsonFixtureName = 'pipelines/pipelines.json'; const jsonFixtureName = 'pipelines/pipelines.json';
const createWrapper = pipeline => const createWrapper = (pipeline) =>
mount(PipelinesTableRowComponent, { mount(PipelinesTableRowComponent, {
propsData: { propsData: {
pipeline, pipeline,
...@@ -24,9 +24,9 @@ describe('Pipelines Table Row', () => { ...@@ -24,9 +24,9 @@ describe('Pipelines Table Row', () => {
beforeEach(() => { beforeEach(() => {
const { pipelines } = getJSONFixture(jsonFixtureName); const { pipelines } = getJSONFixture(jsonFixtureName);
pipeline = pipelines.find(p => p.user !== null && p.commit !== null); pipeline = pipelines.find((p) => p.user !== null && p.commit !== null);
pipelineWithoutAuthor = pipelines.find(p => p.user === null && p.commit !== null); pipelineWithoutAuthor = pipelines.find((p) => p.user === null && p.commit !== null);
pipelineWithoutCommit = pipelines.find(p => p.user === null && p.commit === null); pipelineWithoutCommit = pipelines.find((p) => p.user === null && p.commit === null);
}); });
afterEach(() => { afterEach(() => {
...@@ -187,7 +187,7 @@ describe('Pipelines Table Row', () => { ...@@ -187,7 +187,7 @@ describe('Pipelines Table Row', () => {
}); });
it('emits `retryPipeline` event when retry button is clicked and toggles loading', () => { it('emits `retryPipeline` event when retry button is clicked and toggles loading', () => {
eventHub.$on('retryPipeline', endpoint => { eventHub.$on('retryPipeline', (endpoint) => {
expect(endpoint).toBe('/retry'); expect(endpoint).toBe('/retry');
}); });
...@@ -196,7 +196,7 @@ describe('Pipelines Table Row', () => { ...@@ -196,7 +196,7 @@ describe('Pipelines Table Row', () => {
}); });
it('emits `openConfirmationModal` event when cancel button is clicked and toggles loading', () => { it('emits `openConfirmationModal` event when cancel button is clicked and toggles loading', () => {
eventHub.$once('openConfirmationModal', data => { eventHub.$once('openConfirmationModal', (data) => {
const { id, ref, commit } = pipeline; const { id, ref, commit } = pipeline;
expect(data.endpoint).toBe('/cancel'); expect(data.endpoint).toBe('/cancel');
...@@ -212,7 +212,7 @@ describe('Pipelines Table Row', () => { ...@@ -212,7 +212,7 @@ describe('Pipelines Table Row', () => {
wrapper.find('.js-pipelines-cancel-button').trigger('click'); wrapper.find('.js-pipelines-cancel-button').trigger('click');
}); });
it('renders a loading icon when `cancelingPipeline` matches pipeline id', done => { it('renders a loading icon when `cancelingPipeline` matches pipeline id', (done) => {
wrapper.setProps({ cancelingPipeline: pipeline.id }); wrapper.setProps({ cancelingPipeline: pipeline.id });
wrapper.vm wrapper.vm
.$nextTick() .$nextTick()
......
...@@ -24,7 +24,7 @@ describe('Pipelines Table', () => { ...@@ -24,7 +24,7 @@ describe('Pipelines Table', () => {
beforeEach(() => { beforeEach(() => {
const { pipelines } = getJSONFixture(jsonFixtureName); const { pipelines } = getJSONFixture(jsonFixtureName);
pipeline = pipelines.find(p => p.user !== null && p.commit !== null); pipeline = pipelines.find((p) => p.user !== null && p.commit !== null);
createComponent(); createComponent();
}); });
......
...@@ -32,14 +32,14 @@ describe('EE Pipeline store', () => { ...@@ -32,14 +32,14 @@ describe('EE Pipeline store', () => {
describe('triggered', () => { describe('triggered', () => {
it('adds isExpanding & isLoading keys set to false for each triggered pipeline', () => { it('adds isExpanding & isLoading keys set to false for each triggered pipeline', () => {
store.state.pipeline.triggered.forEach(pipeline => { store.state.pipeline.triggered.forEach((pipeline) => {
expect(pipeline.isExpanded).toEqual(false); expect(pipeline.isExpanded).toEqual(false);
expect(pipeline.isLoading).toEqual(false); expect(pipeline.isLoading).toEqual(false);
}); });
}); });
it('parses nested triggered pipelines', () => { it('parses nested triggered pipelines', () => {
store.state.pipeline.triggered[1].triggered.forEach(pipeline => { store.state.pipeline.triggered[1].triggered.forEach((pipeline) => {
expect(pipeline.isExpanded).toEqual(false); expect(pipeline.isExpanded).toEqual(false);
expect(pipeline.isLoading).toEqual(false); expect(pipeline.isLoading).toEqual(false);
}); });
......
...@@ -39,7 +39,7 @@ describe('Actions TestReports Store', () => { ...@@ -39,7 +39,7 @@ describe('Actions TestReports Store', () => {
mock.onGet(summaryEndpoint).replyOnce(200, summary, {}); mock.onGet(summaryEndpoint).replyOnce(200, summary, {});
}); });
it('sets testReports and shows tests', done => { it('sets testReports and shows tests', (done) => {
testAction( testAction(
actions.fetchSummary, actions.fetchSummary,
null, null,
...@@ -50,7 +50,7 @@ describe('Actions TestReports Store', () => { ...@@ -50,7 +50,7 @@ describe('Actions TestReports Store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
testAction( testAction(
actions.fetchSummary, actions.fetchSummary,
null, null,
...@@ -75,7 +75,7 @@ describe('Actions TestReports Store', () => { ...@@ -75,7 +75,7 @@ describe('Actions TestReports Store', () => {
.replyOnce(200, testReports.test_suites[0], {}); .replyOnce(200, testReports.test_suites[0], {});
}); });
it('sets test suite and shows tests', done => { it('sets test suite and shows tests', (done) => {
const suite = testReports.test_suites[0]; const suite = testReports.test_suites[0];
const index = 0; const index = 0;
...@@ -89,7 +89,7 @@ describe('Actions TestReports Store', () => { ...@@ -89,7 +89,7 @@ describe('Actions TestReports Store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
const index = 0; const index = 0;
testAction( testAction(
...@@ -106,7 +106,7 @@ describe('Actions TestReports Store', () => { ...@@ -106,7 +106,7 @@ describe('Actions TestReports Store', () => {
}); });
describe('when we already have the suite data', () => { describe('when we already have the suite data', () => {
it('should not fetch suite', done => { it('should not fetch suite', (done) => {
const index = 0; const index = 0;
testReports.test_suites[0].hasFullSuite = true; testReports.test_suites[0].hasFullSuite = true;
...@@ -116,7 +116,7 @@ describe('Actions TestReports Store', () => { ...@@ -116,7 +116,7 @@ describe('Actions TestReports Store', () => {
}); });
describe('set selected suite index', () => { describe('set selected suite index', () => {
it('sets selectedSuiteIndex', done => { it('sets selectedSuiteIndex', (done) => {
const selectedSuiteIndex = 0; const selectedSuiteIndex = 0;
testAction( testAction(
...@@ -131,7 +131,7 @@ describe('Actions TestReports Store', () => { ...@@ -131,7 +131,7 @@ describe('Actions TestReports Store', () => {
}); });
describe('remove selected suite index', () => { describe('remove selected suite index', () => {
it('sets selectedSuiteIndex to null', done => { it('sets selectedSuiteIndex to null', (done) => {
testAction( testAction(
actions.removeSelectedSuiteIndex, actions.removeSelectedSuiteIndex,
{}, {},
...@@ -144,11 +144,11 @@ describe('Actions TestReports Store', () => { ...@@ -144,11 +144,11 @@ describe('Actions TestReports Store', () => {
}); });
describe('toggles loading', () => { describe('toggles loading', () => {
it('sets isLoading to true', done => { it('sets isLoading to true', (done) => {
testAction(actions.toggleLoading, {}, state, [{ type: types.TOGGLE_LOADING }], [], done); testAction(actions.toggleLoading, {}, state, [{ type: types.TOGGLE_LOADING }], [], done);
}); });
it('toggles isLoading to false', done => { it('toggles isLoading to false', (done) => {
testAction( testAction(
actions.toggleLoading, actions.toggleLoading,
{}, {},
......
...@@ -40,7 +40,7 @@ describe('Getters TestReports Store', () => { ...@@ -40,7 +40,7 @@ describe('Getters TestReports Store', () => {
setupState(); setupState();
const suites = getters.getTestSuites(state); const suites = getters.getTestSuites(state);
const expected = testReports.test_suites.map(x => ({ const expected = testReports.test_suites.map((x) => ({
...x, ...x,
formattedTime: formattedTime(x.total_time), formattedTime: formattedTime(x.total_time),
})); }));
...@@ -72,7 +72,7 @@ describe('Getters TestReports Store', () => { ...@@ -72,7 +72,7 @@ describe('Getters TestReports Store', () => {
const cases = getters.getSuiteTests(state); const cases = getters.getSuiteTests(state);
const expected = testReports.test_suites[0].test_cases const expected = testReports.test_suites[0].test_cases
.map(x => ({ .map((x) => ({
...x, ...x,
formattedTime: formattedTime(x.execution_time), formattedTime: formattedTime(x.execution_time),
icon: iconForTestStatus(x.status), icon: iconForTestStatus(x.status),
......
...@@ -23,7 +23,7 @@ describe('Test reports suite table', () => { ...@@ -23,7 +23,7 @@ describe('Test reports suite table', () => {
const noCasesMessage = () => wrapper.find('.js-no-test-cases'); const noCasesMessage = () => wrapper.find('.js-no-test-cases');
const allCaseRows = () => wrapper.findAll('.js-case-row'); const allCaseRows = () => wrapper.findAll('.js-case-row');
const findCaseRowAtIndex = index => wrapper.findAll('.js-case-row').at(index); const findCaseRowAtIndex = (index) => wrapper.findAll('.js-case-row').at(index);
const findIconForRow = (row, status) => row.find(`.ci-status-icon-${status}`); const findIconForRow = (row, status) => row.find(`.ci-status-icon-${status}`);
const createComponent = (suite = testSuite, perPage = 20) => { const createComponent = (suite = testSuite, perPage = 20) => {
...@@ -73,8 +73,8 @@ describe('Test reports suite table', () => { ...@@ -73,8 +73,8 @@ describe('Test reports suite table', () => {
TestStatus.SKIPPED, TestStatus.SKIPPED,
TestStatus.SUCCESS, TestStatus.SUCCESS,
'unknown', 'unknown',
])('renders the correct icon for test case with %s status', status => { ])('renders the correct icon for test case with %s status', (status) => {
const test = testCases.findIndex(x => x.status === status); const test = testCases.findIndex((x) => x.status === status);
const row = findCaseRowAtIndex(test); const row = findCaseRowAtIndex(test);
expect(findIconForRow(row, status).exists()).toBe(true); expect(findIconForRow(row, status).exists()).toBe(true);
......
...@@ -22,7 +22,7 @@ describe('Test reports summary', () => { ...@@ -22,7 +22,7 @@ describe('Test reports summary', () => {
showBack: false, showBack: false,
}; };
const createComponent = props => { const createComponent = (props) => {
wrapper = mount(Summary, { wrapper = mount(Summary, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
......
...@@ -26,7 +26,7 @@ describe('Pipeline Trigger Author Token', () => { ...@@ -26,7 +26,7 @@ describe('Pipeline Trigger Author Token', () => {
}, },
}; };
const createComponent = data => { const createComponent = (data) => {
wrapper = shallowMount(PipelineTriggerAuthorToken, { wrapper = shallowMount(PipelineTriggerAuthorToken, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
......
...@@ -89,7 +89,7 @@ const completeMock = [ ...@@ -89,7 +89,7 @@ const completeMock = [
{ {
...basicStageInfo, ...basicStageInfo,
groups: { groups: {
nodes: groupsArray.map(group => ({ ...group, jobs: { nodes: jobArrayWithNeeds } })), nodes: groupsArray.map((group) => ({ ...group, jobs: { nodes: jobArrayWithNeeds } })),
}, },
}, },
]; ];
......
...@@ -56,7 +56,7 @@ describe('DeleteAccountModal component', () => { ...@@ -56,7 +56,7 @@ describe('DeleteAccountModal component', () => {
const findModal = () => wrapper.find(GlModalStub); const findModal = () => wrapper.find(GlModalStub);
describe('with password confirmation', () => { describe('with password confirmation', () => {
beforeEach(done => { beforeEach((done) => {
createWrapper({ createWrapper({
propsData: { propsData: {
confirmWithPassword: true, confirmWithPassword: true,
...@@ -68,7 +68,7 @@ describe('DeleteAccountModal component', () => { ...@@ -68,7 +68,7 @@ describe('DeleteAccountModal component', () => {
Vue.nextTick().then(done).catch(done.fail); Vue.nextTick().then(done).catch(done.fail);
}); });
it('does not accept empty password', done => { it('does not accept empty password', (done) => {
const { form, input } = findElements(); const { form, input } = findElements();
jest.spyOn(form, 'submit').mockImplementation(() => {}); jest.spyOn(form, 'submit').mockImplementation(() => {});
input.value = ''; input.value = '';
...@@ -86,7 +86,7 @@ describe('DeleteAccountModal component', () => { ...@@ -86,7 +86,7 @@ describe('DeleteAccountModal component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('submits form with password', done => { it('submits form with password', (done) => {
const { form, input } = findElements(); const { form, input } = findElements();
jest.spyOn(form, 'submit').mockImplementation(() => {}); jest.spyOn(form, 'submit').mockImplementation(() => {});
input.value = 'anything'; input.value = 'anything';
...@@ -106,7 +106,7 @@ describe('DeleteAccountModal component', () => { ...@@ -106,7 +106,7 @@ describe('DeleteAccountModal component', () => {
}); });
describe('with username confirmation', () => { describe('with username confirmation', () => {
beforeEach(done => { beforeEach((done) => {
createWrapper({ createWrapper({
propsData: { propsData: {
confirmWithPassword: false, confirmWithPassword: false,
...@@ -118,7 +118,7 @@ describe('DeleteAccountModal component', () => { ...@@ -118,7 +118,7 @@ describe('DeleteAccountModal component', () => {
Vue.nextTick().then(done).catch(done.fail); Vue.nextTick().then(done).catch(done.fail);
}); });
it('does not accept wrong username', done => { it('does not accept wrong username', (done) => {
const { form, input } = findElements(); const { form, input } = findElements();
jest.spyOn(form, 'submit').mockImplementation(() => {}); jest.spyOn(form, 'submit').mockImplementation(() => {});
input.value = 'this is wrong'; input.value = 'this is wrong';
...@@ -136,7 +136,7 @@ describe('DeleteAccountModal component', () => { ...@@ -136,7 +136,7 @@ describe('DeleteAccountModal component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('submits form with correct username', done => { it('submits form with correct username', (done) => {
const { form, input } = findElements(); const { form, input } = findElements();
jest.spyOn(form, 'submit').mockImplementation(() => {}); jest.spyOn(form, 'submit').mockImplementation(() => {});
input.value = username; input.value = username;
......
...@@ -7,7 +7,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -7,7 +7,7 @@ import axios from '~/lib/utils/axios_utils';
jest.mock('~/lib/dompurify', () => ({ jest.mock('~/lib/dompurify', () => ({
addHook: jest.fn(), addHook: jest.fn(),
sanitize: jest.fn(val => val), sanitize: jest.fn((val) => val),
})); }));
const BLOB_URL_TEMPLATE = `${TEST_HOST}/namespace/project/blob/master`; const BLOB_URL_TEMPLATE = `${TEST_HOST}/namespace/project/blob/master`;
...@@ -39,7 +39,7 @@ describe('ProjectFindFile', () => { ...@@ -39,7 +39,7 @@ describe('ProjectFindFile', () => {
element element
.find('.tree-table tr') .find('.tree-table tr')
.toArray() .toArray()
.map(el => ({ .map((el) => ({
text: el.textContent, text: el.textContent,
href: el.querySelector('a').href, href: el.querySelector('a').href,
})); }));
...@@ -53,14 +53,14 @@ describe('ProjectFindFile', () => { ...@@ -53,14 +53,14 @@ describe('ProjectFindFile', () => {
{ path: 'folde?rC/fil#F.txt', escaped: 'folde%3FrC/fil%23F.txt' }, { path: 'folde?rC/fil#F.txt', escaped: 'folde%3FrC/fil%23F.txt' },
]; ];
beforeEach(done => { beforeEach((done) => {
// Create a mock adapter for stubbing axios API requests // Create a mock adapter for stubbing axios API requests
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
element = $(TEMPLATE); element = $(TEMPLATE);
mock.onGet(FILE_FIND_URL).replyOnce( mock.onGet(FILE_FIND_URL).replyOnce(
200, 200,
files.map(x => x.path), files.map((x) => x.path),
); );
getProjectFindFileInstance(); // This triggers a load / axios call + subsequent render in the constructor getProjectFindFileInstance(); // This triggers a load / axios call + subsequent render in the constructor
......
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