Commit 4700ac1d authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 34 spec files: 8 of 10

Mandatory not to break master. Automatically created with prettier.
parent 21fa9ca4
...@@ -11,20 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql ...@@ -11,20 +11,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.md *.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively: # temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
spec/frontend/notes
spec/frontend/packages/details/components
spec/frontend/packages/details/store
spec/frontend/packages/list/stores
spec/frontend/packages/shared/components
spec/frontend/pages/projects/forks/new/components
spec/frontend/pages/projects/pipeline_schedules/shared/components
spec/frontend/pages/projects/shared/permissions/components
spec/frontend/pages/search/show
spec/frontend/pages/sessions/new
spec/frontend/pipeline_editor
spec/frontend/pipeline_editor/components/lint
spec/frontend/pipeline_new/components
spec/frontend/pipelines
spec/frontend/profile/account/components spec/frontend/profile/account/components
spec/frontend/projects spec/frontend/projects
spec/frontend/prometheus_metrics spec/frontend/prometheus_metrics
......
...@@ -117,19 +117,13 @@ describe('DiscussionActions', () => { ...@@ -117,19 +117,13 @@ describe('DiscussionActions', () => {
it('emits showReplyForm event when clicking on reply placeholder', () => { it('emits showReplyForm event when clicking on reply placeholder', () => {
jest.spyOn(wrapper.vm, '$emit'); jest.spyOn(wrapper.vm, '$emit');
wrapper wrapper.find(ReplyPlaceholder).find('button').trigger('click');
.find(ReplyPlaceholder)
.find('button')
.trigger('click');
expect(wrapper.vm.$emit).toHaveBeenCalledWith('showReplyForm'); expect(wrapper.vm.$emit).toHaveBeenCalledWith('showReplyForm');
}); });
it('emits resolve event when clicking on resolve button', () => { it('emits resolve event when clicking on resolve button', () => {
jest.spyOn(wrapper.vm, '$emit'); jest.spyOn(wrapper.vm, '$emit');
wrapper wrapper.find(ResolveDiscussionButton).find('button').trigger('click');
.find(ResolveDiscussionButton)
.find('button')
.trigger('click');
expect(wrapper.vm.$emit).toHaveBeenCalledWith('resolve'); expect(wrapper.vm.$emit).toHaveBeenCalledWith('resolve');
}); });
}); });
......
...@@ -31,20 +31,14 @@ describe('DiscussionFilterNote component', () => { ...@@ -31,20 +31,14 @@ describe('DiscussionFilterNote component', () => {
it('emits `dropdownSelect` event with 0 parameter on clicking Show all activity button', () => { it('emits `dropdownSelect` event with 0 parameter on clicking Show all activity button', () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
wrapper wrapper.findAll(GlButton).at(0).vm.$emit('click');
.findAll(GlButton)
.at(0)
.vm.$emit('click');
expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 0); expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 0);
}); });
it('emits `dropdownSelect` event with 1 parameter on clicking Show comments only button', () => { it('emits `dropdownSelect` event with 1 parameter on clicking Show comments only button', () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
wrapper wrapper.findAll(GlButton).at(1).vm.$emit('click');
.findAll(GlButton)
.at(1)
.vm.$emit('click');
expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 1); expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 1);
}); });
......
...@@ -82,12 +82,9 @@ describe('DiscussionFilter component', () => { ...@@ -82,12 +82,9 @@ describe('DiscussionFilter component', () => {
}); });
it('renders the default selected item', () => { it('renders the default selected item', () => {
expect( expect(wrapper.find('#discussion-filter-dropdown .dropdown-item').text().trim()).toBe(
wrapper discussionFiltersMock[0].title,
.find('#discussion-filter-dropdown .dropdown-item') );
.text()
.trim(),
).toBe(discussionFiltersMock[0].title);
}); });
it('updates to the selected item', () => { it('updates to the selected item', () => {
......
...@@ -65,23 +65,11 @@ describe('noteActions', () => { ...@@ -65,23 +65,11 @@ describe('noteActions', () => {
}); });
it('should render noteable author badge', () => { it('should render noteable author badge', () => {
expect( expect(wrapper.findAll('.note-role').at(0).text().trim()).toEqual('Author');
wrapper
.findAll('.note-role')
.at(0)
.text()
.trim(),
).toEqual('Author');
}); });
it('should render access level badge', () => { it('should render access level badge', () => {
expect( expect(wrapper.findAll('.note-role').at(1).text().trim()).toEqual(props.accessLevel);
wrapper
.findAll('.note-role')
.at(1)
.text()
.trim(),
).toEqual(props.accessLevel);
}); });
it('should render contributor badge', () => { it('should render contributor badge', () => {
...@@ -91,13 +79,7 @@ describe('noteActions', () => { ...@@ -91,13 +79,7 @@ describe('noteActions', () => {
}); });
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(wrapper.findAll('.note-role').at(1).text().trim()).toBe('Contributor');
wrapper
.findAll('.note-role')
.at(1)
.text()
.trim(),
).toBe('Contributor');
}); });
}); });
......
...@@ -91,12 +91,7 @@ describe('issue_note_form component', () => { ...@@ -91,12 +91,7 @@ describe('issue_note_form component', () => {
const conflictWarning = wrapper.find('.js-conflict-edit-warning'); const conflictWarning = wrapper.find('.js-conflict-edit-warning');
expect(conflictWarning.exists()).toBe(true); expect(conflictWarning.exists()).toBe(true);
expect( expect(conflictWarning.text().replace(/\s+/g, ' ').trim()).toBe(message);
conflictWarning
.text()
.replace(/\s+/g, ' ')
.trim(),
).toBe(message);
}); });
}); });
}); });
......
...@@ -129,12 +129,9 @@ describe('note_app', () => { ...@@ -129,12 +129,9 @@ describe('note_app', () => {
'/gitlab-org/gitlab-foss/issues/26/discussions.json' '/gitlab-org/gitlab-foss/issues/26/discussions.json'
][0].notes[0]; ][0].notes[0];
expect( expect(wrapper.find('.main-notes-list .note-header-author-name').text().trim()).toEqual(
wrapper note.author.name,
.find('.main-notes-list .note-header-author-name') );
.text()
.trim(),
).toEqual(note.author.name);
expect(wrapper.find('.main-notes-list .note-text').html()).toContain(note.note_html); expect(wrapper.find('.main-notes-list .note-text').html()).toContain(note.note_html);
}); });
...@@ -272,23 +269,15 @@ describe('note_app', () => { ...@@ -272,23 +269,15 @@ describe('note_app', () => {
it('should render markdown docs url', () => { it('should render markdown docs url', () => {
const { markdownDocsPath } = mockData.notesDataMock; const { markdownDocsPath } = mockData.notesDataMock;
expect( expect(wrapper.find(`a[href="${markdownDocsPath}"]`).text().trim()).toEqual('Markdown');
wrapper
.find(`a[href="${markdownDocsPath}"]`)
.text()
.trim(),
).toEqual('Markdown');
}); });
it('should render quick action docs url', () => { it('should render quick action docs url', () => {
const { quickActionsDocsPath } = mockData.notesDataMock; const { quickActionsDocsPath } = mockData.notesDataMock;
expect( expect(wrapper.find(`a[href="${quickActionsDocsPath}"]`).text().trim()).toEqual(
wrapper 'quick actions',
.find(`a[href="${quickActionsDocsPath}"]`) );
.text()
.trim(),
).toEqual('quick actions');
}); });
}); });
...@@ -304,12 +293,9 @@ describe('note_app', () => { ...@@ -304,12 +293,9 @@ describe('note_app', () => {
const { markdownDocsPath } = mockData.notesDataMock; const { markdownDocsPath } = mockData.notesDataMock;
return Vue.nextTick().then(() => { return Vue.nextTick().then(() => {
expect( expect(wrapper.find(`.edit-note a[href="${markdownDocsPath}"]`).text().trim()).toEqual(
wrapper 'Markdown is supported',
.find(`.edit-note a[href="${markdownDocsPath}"]`) );
.text()
.trim(),
).toEqual('Markdown is supported');
}); });
}); });
......
...@@ -82,9 +82,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -82,9 +82,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
it('modifies the Markdown field', () => { it('modifies the Markdown field', () => {
const changeEvent = document.createEvent('HTMLEvents'); const changeEvent = document.createEvent('HTMLEvents');
changeEvent.initEvent('change', true, true); changeEvent.initEvent('change', true, true);
$('input[type=checkbox]') $('input[type=checkbox]').attr('checked', true)[0].dispatchEvent(changeEvent);
.attr('checked', true)[0]
.dispatchEvent(changeEvent);
expect($('.js-task-list-field.original-task-list').val()).toBe('- [x] Task List Item'); expect($('.js-task-list-field.original-task-list').val()).toBe('- [x] Task List Item');
}); });
...@@ -746,12 +744,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -746,12 +744,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
.find(`#note_${note.id}`) .find(`#note_${note.id}`)
.find('.js-task-list-container'); .find('.js-task-list-container');
expect( expect($updatedNoteEl.find('.note-text').text().trim()).toEqual('');
$updatedNoteEl
.find('.note-text')
.text()
.trim(),
).toEqual('');
done(); done();
}); });
...@@ -912,26 +905,15 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -912,26 +905,15 @@ describe.skip('Old Notes (~/notes.js)', () => {
expect($tempNote.find('.timeline-icon .avatar').attr('src')).toEqual(currentUserAvatar); expect($tempNote.find('.timeline-icon .avatar').attr('src')).toEqual(currentUserAvatar);
expect($tempNote.find('.timeline-content').hasClass('discussion')).toBeFalsy(); expect($tempNote.find('.timeline-content').hasClass('discussion')).toBeFalsy();
expect( expect($tempNoteHeader.find('.d-none.d-sm-inline-block').text().trim()).toEqual(
$tempNoteHeader currentUserFullname,
.find('.d-none.d-sm-inline-block') );
.text()
.trim(), expect($tempNoteHeader.find('.note-headline-light').text().trim()).toEqual(
).toEqual(currentUserFullname); `@${currentUsername}`,
);
expect(
$tempNoteHeader expect($tempNote.find('.note-body .note-text p').text().trim()).toEqual(sampleComment);
.find('.note-headline-light')
.text()
.trim(),
).toEqual(`@${currentUsername}`);
expect(
$tempNote
.find('.note-body .note-text p')
.text()
.trim(),
).toEqual(sampleComment);
}); });
it('should return constructed placeholder element for discussion note based on form contents', () => { it('should return constructed placeholder element for discussion note based on form contents', () => {
...@@ -959,12 +941,9 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -959,12 +941,9 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
const $tempNoteHeader = $tempNote.find('.note-header'); const $tempNoteHeader = $tempNote.find('.note-header');
expect( expect($tempNoteHeader.find('.d-none.d-sm-inline-block').text().trim()).toEqual(
$tempNoteHeader 'Foo <script>alert("XSS")</script>',
.find('.d-none.d-sm-inline-block') );
.text()
.trim(),
).toEqual('Foo <script>alert("XSS")</script>');
}); });
}); });
...@@ -987,12 +966,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -987,12 +966,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
expect($tempNote.attr('id')).toEqual(uniqueId); expect($tempNote.attr('id')).toEqual(uniqueId);
expect($tempNote.hasClass('being-posted')).toBeTruthy(); expect($tempNote.hasClass('being-posted')).toBeTruthy();
expect($tempNote.hasClass('fade-in-half')).toBeTruthy(); expect($tempNote.hasClass('fade-in-half')).toBeTruthy();
expect( expect($tempNote.find('.timeline-content i').text().trim()).toEqual(sampleCommandDescription);
$tempNote
.find('.timeline-content i')
.text()
.trim(),
).toEqual(sampleCommandDescription);
}); });
}); });
......
...@@ -302,10 +302,7 @@ describe('Actions Notes Store', () => { ...@@ -302,10 +302,7 @@ describe('Actions Notes Store', () => {
.onGet(notesDataMock.notesPath) .onGet(notesDataMock.notesPath)
.reply(200, { notes: [], last_fetched_at: '123456' }, { 'poll-interval': '1000' }); .reply(200, { notes: [], last_fetched_at: '123456' }, { 'poll-interval': '1000' });
store store.dispatch('setNotesData', notesDataMock).then(done).catch(done.fail);
.dispatch('setNotesData', notesDataMock)
.then(done)
.catch(done.fail);
}); });
it('calls service with last fetched state', done => { it('calls service with last fetched state', done => {
......
...@@ -298,8 +298,10 @@ describe('Getters Notes Store', () => { ...@@ -298,8 +298,10 @@ describe('Getters Notes Store', () => {
}; };
}); });
[{ step: 1, id: '123', expected: '123' }, { step: -1, id: '123', expected: '123' }].forEach( [
({ step, id, expected }) => { { step: 1, id: '123', expected: '123' },
{ step: -1, id: '123', expected: '123' },
].forEach(({ step, id, expected }) => {
it(`with step ${step} and match, returns only value`, () => { it(`with step ${step} and match, returns only value`, () => {
const params = createDiscussionNeighborParams(id, true, step); const params = createDiscussionNeighborParams(id, true, step);
...@@ -307,8 +309,7 @@ describe('Getters Notes Store', () => { ...@@ -307,8 +309,7 @@ describe('Getters Notes Store', () => {
expected, expected,
); );
}); });
}, });
);
it('with no match, returns only value', () => { it('with no match, returns only value', () => {
const params = createDiscussionNeighborParams('bogus', true, 1); const params = createDiscussionNeighborParams('bogus', true, 1);
......
...@@ -48,21 +48,13 @@ describe('ConanInstallation', () => { ...@@ -48,21 +48,13 @@ describe('ConanInstallation', () => {
describe('installation commands', () => { describe('installation commands', () => {
it('renders the correct command', () => { it('renders the correct command', () => {
expect( expect(findCodeInstructions().at(0).props('instruction')).toBe(conanInstallationCommandStr);
findCodeInstructions()
.at(0)
.props('instruction'),
).toBe(conanInstallationCommandStr);
}); });
}); });
describe('setup commands', () => { describe('setup commands', () => {
it('renders the correct command', () => { it('renders the correct command', () => {
expect( expect(findCodeInstructions().at(1).props('instruction')).toBe(conanSetupCommandStr);
findCodeInstructions()
.at(1)
.props('instruction'),
).toBe(conanSetupCommandStr);
}); });
}); });
}); });
...@@ -51,11 +51,7 @@ describe('MavenInstallation', () => { ...@@ -51,11 +51,7 @@ describe('MavenInstallation', () => {
describe('installation commands', () => { describe('installation commands', () => {
it('renders the correct xml block', () => { it('renders the correct xml block', () => {
expect( expect(findCodeInstructions().at(0).props()).toMatchObject({
findCodeInstructions()
.at(0)
.props(),
).toMatchObject({
instruction: xmlCodeBlock, instruction: xmlCodeBlock,
multiline: true, multiline: true,
trackingAction: TrackingActions.COPY_MAVEN_XML, trackingAction: TrackingActions.COPY_MAVEN_XML,
...@@ -63,11 +59,7 @@ describe('MavenInstallation', () => { ...@@ -63,11 +59,7 @@ describe('MavenInstallation', () => {
}); });
it('renders the correct maven command', () => { it('renders the correct maven command', () => {
expect( expect(findCodeInstructions().at(1).props()).toMatchObject({
findCodeInstructions()
.at(1)
.props(),
).toMatchObject({
instruction: mavenCommandStr, instruction: mavenCommandStr,
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_MAVEN_COMMAND, trackingAction: TrackingActions.COPY_MAVEN_COMMAND,
...@@ -77,11 +69,7 @@ describe('MavenInstallation', () => { ...@@ -77,11 +69,7 @@ describe('MavenInstallation', () => {
describe('setup commands', () => { describe('setup commands', () => {
it('renders the correct xml block', () => { it('renders the correct xml block', () => {
expect( expect(findCodeInstructions().at(2).props()).toMatchObject({
findCodeInstructions()
.at(2)
.props(),
).toMatchObject({
instruction: mavenSetupXml, instruction: mavenSetupXml,
multiline: true, multiline: true,
trackingAction: TrackingActions.COPY_MAVEN_SETUP, trackingAction: TrackingActions.COPY_MAVEN_SETUP,
......
...@@ -47,11 +47,7 @@ describe('NpmInstallation', () => { ...@@ -47,11 +47,7 @@ describe('NpmInstallation', () => {
describe('installation commands', () => { describe('installation commands', () => {
it('renders the correct npm command', () => { it('renders the correct npm command', () => {
expect( expect(findCodeInstructions().at(0).props()).toMatchObject({
findCodeInstructions()
.at(0)
.props(),
).toMatchObject({
instruction: 'npm i @Test/package', instruction: 'npm i @Test/package',
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_NPM_INSTALL_COMMAND, trackingAction: TrackingActions.COPY_NPM_INSTALL_COMMAND,
...@@ -59,11 +55,7 @@ describe('NpmInstallation', () => { ...@@ -59,11 +55,7 @@ describe('NpmInstallation', () => {
}); });
it('renders the correct yarn command', () => { it('renders the correct yarn command', () => {
expect( expect(findCodeInstructions().at(1).props()).toMatchObject({
findCodeInstructions()
.at(1)
.props(),
).toMatchObject({
instruction: 'yarn add @Test/package', instruction: 'yarn add @Test/package',
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_YARN_INSTALL_COMMAND, trackingAction: TrackingActions.COPY_YARN_INSTALL_COMMAND,
...@@ -73,11 +65,7 @@ describe('NpmInstallation', () => { ...@@ -73,11 +65,7 @@ describe('NpmInstallation', () => {
describe('setup commands', () => { describe('setup commands', () => {
it('renders the correct npm command', () => { it('renders the correct npm command', () => {
expect( expect(findCodeInstructions().at(2).props()).toMatchObject({
findCodeInstructions()
.at(2)
.props(),
).toMatchObject({
instruction: 'echo @Test:registry=undefined/ >> .npmrc', instruction: 'echo @Test:registry=undefined/ >> .npmrc',
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_NPM_SETUP_COMMAND, trackingAction: TrackingActions.COPY_NPM_SETUP_COMMAND,
...@@ -85,11 +73,7 @@ describe('NpmInstallation', () => { ...@@ -85,11 +73,7 @@ describe('NpmInstallation', () => {
}); });
it('renders the correct yarn command', () => { it('renders the correct yarn command', () => {
expect( expect(findCodeInstructions().at(3).props()).toMatchObject({
findCodeInstructions()
.at(3)
.props(),
).toMatchObject({
instruction: 'echo \\"@Test:registry\\" \\"undefined/\\" >> .yarnrc', instruction: 'echo \\"@Test:registry\\" \\"undefined/\\" >> .yarnrc',
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_YARN_SETUP_COMMAND, trackingAction: TrackingActions.COPY_YARN_SETUP_COMMAND,
......
...@@ -49,11 +49,7 @@ describe('NugetInstallation', () => { ...@@ -49,11 +49,7 @@ describe('NugetInstallation', () => {
describe('installation commands', () => { describe('installation commands', () => {
it('renders the correct command', () => { it('renders the correct command', () => {
expect( expect(findCodeInstructions().at(0).props()).toMatchObject({
findCodeInstructions()
.at(0)
.props(),
).toMatchObject({
instruction: nugetInstallationCommandStr, instruction: nugetInstallationCommandStr,
trackingAction: TrackingActions.COPY_NUGET_INSTALL_COMMAND, trackingAction: TrackingActions.COPY_NUGET_INSTALL_COMMAND,
}); });
...@@ -62,11 +58,7 @@ describe('NugetInstallation', () => { ...@@ -62,11 +58,7 @@ describe('NugetInstallation', () => {
describe('setup commands', () => { describe('setup commands', () => {
it('renders the correct command', () => { it('renders the correct command', () => {
expect( expect(findCodeInstructions().at(1).props()).toMatchObject({
findCodeInstructions()
.at(1)
.props(),
).toMatchObject({
instruction: nugetSetupCommandStr, instruction: nugetSetupCommandStr,
trackingAction: TrackingActions.COPY_NUGET_SETUP_COMMAND, trackingAction: TrackingActions.COPY_NUGET_SETUP_COMMAND,
}); });
......
...@@ -42,7 +42,10 @@ describe('Actions Package details store', () => { ...@@ -42,7 +42,10 @@ describe('Actions Package details store', () => {
fetchPackageVersions, fetchPackageVersions,
undefined, undefined,
{ packageEntity }, { packageEntity },
[{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], [
{ type: types.SET_LOADING, payload: true },
{ type: types.SET_LOADING, payload: false },
],
[], [],
() => { () => {
expect(Api.projectPackage).toHaveBeenCalledWith( expect(Api.projectPackage).toHaveBeenCalledWith(
...@@ -61,7 +64,10 @@ describe('Actions Package details store', () => { ...@@ -61,7 +64,10 @@ describe('Actions Package details store', () => {
fetchPackageVersions, fetchPackageVersions,
undefined, undefined,
{ packageEntity }, { packageEntity },
[{ type: types.SET_LOADING, payload: true }, { type: types.SET_LOADING, payload: false }], [
{ type: types.SET_LOADING, payload: true },
{ type: types.SET_LOADING, payload: false },
],
[], [],
() => { () => {
expect(Api.projectPackage).toHaveBeenCalledWith( expect(Api.projectPackage).toHaveBeenCalledWith(
......
...@@ -109,7 +109,10 @@ describe('Actions Package list store', () => { ...@@ -109,7 +109,10 @@ describe('Actions Package list store', () => {
undefined, undefined,
{ config: { isGroupPage: false, resourceId: 2 }, sorting }, { config: { isGroupPage: false, resourceId: 2 }, sorting },
[], [],
[{ type: 'setLoading', payload: true }, { type: 'setLoading', payload: false }], [
{ type: 'setLoading', payload: true },
{ type: 'setLoading', payload: false },
],
() => { () => {
expect(createFlash).toHaveBeenCalled(); expect(createFlash).toHaveBeenCalled();
done(); done();
...@@ -192,7 +195,10 @@ describe('Actions Package list store', () => { ...@@ -192,7 +195,10 @@ describe('Actions Package list store', () => {
payload, payload,
null, null,
[], [],
[{ type: 'setLoading', payload: true }, { type: 'setLoading', payload: false }], [
{ type: 'setLoading', payload: true },
{ type: 'setLoading', payload: false },
],
() => { () => {
expect(createFlash).toHaveBeenCalled(); expect(createFlash).toHaveBeenCalled();
done(); done();
......
...@@ -75,11 +75,7 @@ describe('PackageTags', () => { ...@@ -75,11 +75,7 @@ describe('PackageTags', () => {
const expectedStyle = [...defaultStyle, 'gl-display-flex', 'gl-ml-3']; const expectedStyle = [...defaultStyle, 'gl-display-flex', 'gl-ml-3'];
expect( expect(tagBadges().at(0).classes()).toEqual(expect.arrayContaining(expectedStyle));
tagBadges()
.at(0)
.classes(),
).toEqual(expect.arrayContaining(expectedStyle));
}); });
it('shows tag badge for medium or heigher resolutions', () => { it('shows tag badge for medium or heigher resolutions', () => {
...@@ -87,11 +83,7 @@ describe('PackageTags', () => { ...@@ -87,11 +83,7 @@ describe('PackageTags', () => {
const expectedStyle = [...defaultStyle, 'd-md-flex']; const expectedStyle = [...defaultStyle, 'd-md-flex'];
expect( expect(tagBadges().at(1).classes()).toEqual(expect.arrayContaining(expectedStyle));
tagBadges()
.at(1)
.classes(),
).toEqual(expect.arrayContaining(expectedStyle));
}); });
it('correctly prepends left and appends right when there is more than one tag', () => { it('correctly prepends left and appends right when there is more than one tag', () => {
......
...@@ -104,12 +104,10 @@ describe('Fork groups list component', () => { ...@@ -104,12 +104,10 @@ describe('Fork groups list component', () => {
expect(wrapper.findAll(ForkGroupsListItem)).toHaveLength(namespaces.length); expect(wrapper.findAll(ForkGroupsListItem)).toHaveLength(namespaces.length);
namespaces.forEach((namespace, idx) => { namespaces.forEach((namespace, idx) => {
expect( expect(wrapper.findAll(ForkGroupsListItem).at(idx).props()).toStrictEqual({
wrapper group: namespace,
.findAll(ForkGroupsListItem) hasReachedProjectLimit,
.at(idx) });
.props(),
).toStrictEqual({ group: namespace, hasReachedProjectLimit });
}); });
}); });
...@@ -123,11 +121,6 @@ describe('Fork groups list component', () => { ...@@ -123,11 +121,6 @@ describe('Fork groups list component', () => {
await nextTick(); await nextTick();
expect(wrapper.findAll(ForkGroupsListItem)).toHaveLength(1); expect(wrapper.findAll(ForkGroupsListItem)).toHaveLength(1);
expect( expect(wrapper.findAll(ForkGroupsListItem).at(0).props().group.name).toBe('otherdummy');
wrapper
.findAll(ForkGroupsListItem)
.at(0)
.props().group.name,
).toBe('otherdummy');
}); });
}); });
...@@ -88,10 +88,7 @@ describe('Timezone Dropdown', () => { ...@@ -88,10 +88,7 @@ describe('Timezone Dropdown', () => {
onSelectTimezone, onSelectTimezone,
}); });
$wrapper $wrapper.find(tzListSel).first().trigger('click');
.find(tzListSel)
.first()
.trigger('click');
expect(onSelectTimezone).toHaveBeenCalled(); expect(onSelectTimezone).toHaveBeenCalled();
}); });
...@@ -118,10 +115,7 @@ describe('Timezone Dropdown', () => { ...@@ -118,10 +115,7 @@ describe('Timezone Dropdown', () => {
displayFormat, displayFormat,
}); });
$wrapper $wrapper.find(tzListSel).first().trigger('click');
.find(tzListSel)
.first()
.trigger('click');
expect(displayFormat).toHaveBeenCalled(); expect(displayFormat).toHaveBeenCalled();
}); });
......
...@@ -6,7 +6,13 @@ import projectFeatureToggle from '~/vue_shared/components/toggle_button.vue'; ...@@ -6,7 +6,13 @@ import projectFeatureToggle from '~/vue_shared/components/toggle_button.vue';
describe('Project Feature Settings', () => { describe('Project Feature Settings', () => {
const defaultProps = { const defaultProps = {
name: 'Test', name: 'Test',
options: [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]], options: [
[1, 1],
[2, 2],
[3, 3],
[4, 4],
[5, 5],
],
value: 1, value: 1,
disabledInput: false, disabledInput: false,
showToggle: true, showToggle: true,
...@@ -82,10 +88,7 @@ describe('Project Feature Settings', () => { ...@@ -82,10 +88,7 @@ describe('Project Feature Settings', () => {
wrapper = mount(projectFeatureSetting, { propsData: defaultProps }); wrapper = mount(projectFeatureSetting, { propsData: defaultProps });
expect(wrapper.emitted().change).toBeUndefined(); expect(wrapper.emitted().change).toBeUndefined();
wrapper wrapper.find(projectFeatureToggle).find('button').trigger('click');
.find(projectFeatureToggle)
.find('button')
.trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().change.length).toBe(1); expect(wrapper.emitted().change.length).toBe(1);
...@@ -119,10 +122,7 @@ describe('Project Feature Settings', () => { ...@@ -119,10 +122,7 @@ describe('Project Feature Settings', () => {
it('should emit the change when a new option is selected', () => { it('should emit the change when a new option is selected', () => {
expect(wrapper.emitted().change).toBeUndefined(); expect(wrapper.emitted().change).toBeUndefined();
wrapper wrapper.findAll('option').at(1).trigger('change');
.findAll('option')
.at(1)
.trigger('change');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().change.length).toBe(1); expect(wrapper.emitted().change.length).toBe(1);
......
...@@ -5,7 +5,10 @@ import refreshCounts from '~/pages/search/show/refresh_counts'; ...@@ -5,7 +5,10 @@ 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 = [{ scope: 'issues', count: 4 }, { scope: 'merge_requests', count: 5 }]; const counts = [
{ scope: 'issues', count: 4 },
{ scope: 'merge_requests', count: 5 },
];
const fixture = `<div class="badge">22</div> const fixture = `<div class="badge">22</div>
<div class="badge js-search-count hidden" data-url="${urlWithScope('issues')}"></div> <div class="badge js-search-count hidden" data-url="${urlWithScope('issues')}"></div>
<div class="badge js-search-count hidden" data-url="${urlWithScope('merge_requests')}"></div>`; <div class="badge js-search-count hidden" data-url="${urlWithScope('merge_requests')}"></div>`;
......
...@@ -3,9 +3,7 @@ import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment'; ...@@ -3,9 +3,7 @@ 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}`) return $(`.omniauth-container ${selector}`).parent('form').attr('action');
.parent('form')
.attr('action');
}; };
preloadFixtures('sessions/new.html'); preloadFixtures('sessions/new.html');
......
...@@ -49,11 +49,7 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => { ...@@ -49,11 +49,7 @@ describe('~/pipeline_editor/components/lint/ci_lint.vue', () => {
}); });
it('displays link to the right help page', () => { it('displays link to the right help page', () => {
expect( expect(findAlert().find(GlLink).attributes('href')).toBe(mockLintHelpPagePath);
findAlert()
.find(GlLink)
.attributes('href'),
).toBe(mockLintHelpPagePath);
}); });
it('displays jobs', () => { it('displays jobs', () => {
......
...@@ -177,11 +177,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -177,11 +177,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
}); });
it('displays the tab and its content', async () => { it('displays the tab and its content', async () => {
expect( expect(findTabAt(0).find(TextEditor).exists()).toBe(true);
findTabAt(0)
.find(TextEditor)
.exists(),
).toBe(true);
}); });
it('displays tab lazily, until editor is ready', async () => { it('displays tab lazily, until editor is ready', async () => {
......
...@@ -44,10 +44,7 @@ describe('Pipeline New Form', () => { ...@@ -44,10 +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 => const changeRef = i => findDropdownItems().at(i).vm.$emit('click');
findDropdownItems()
.at(i)
.vm.$emit('click');
const createComponent = (term = '', props = {}, method = shallowMount) => { const createComponent = (term = '', props = {}, method = shallowMount) => {
wrapper = method(PipelineNewForm, { wrapper = method(PipelineNewForm, {
...@@ -99,11 +96,7 @@ describe('Pipeline New Form', () => { ...@@ -99,11 +96,7 @@ describe('Pipeline New Form', () => {
createComponent('master'); createComponent('master');
expect(findDropdownItems()).toHaveLength(1); expect(findDropdownItems()).toHaveLength(1);
expect( expect(findDropdownItems().at(0).text()).toBe('master');
findDropdownItems()
.at(0)
.text(),
).toBe('master');
}); });
}); });
...@@ -136,9 +129,7 @@ describe('Pipeline New Form', () => { ...@@ -136,9 +129,7 @@ describe('Pipeline New Form', () => {
}); });
it('removes ci variable row on remove icon button click', async () => { it('removes ci variable row on remove icon button click', async () => {
findRemoveIcons() findRemoveIcons().at(1).trigger('click');
.at(1)
.trigger('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -298,26 +289,16 @@ describe('Pipeline New Form', () => { ...@@ -298,26 +289,16 @@ describe('Pipeline New Form', () => {
}); });
it('adds a description to the first variable from yml', () => { it('adds a description to the first variable from yml', () => {
expect( expect(findVariableRows().at(0).text()).toContain(mockYmlDesc);
findVariableRows()
.at(0)
.text(),
).toContain(mockYmlDesc);
}); });
it('removes the description when a variable key changes', async () => { it('removes the description when a variable key changes', async () => {
findKeyInputs().at(0).element.value = 'yml_var_modified'; findKeyInputs().at(0).element.value = 'yml_var_modified';
findKeyInputs() findKeyInputs().at(0).trigger('change');
.at(0)
.trigger('change');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findVariableRows().at(0).text()).not.toContain(mockYmlDesc);
findVariableRows()
.at(0)
.text(),
).not.toContain(mockYmlDesc);
}); });
}); });
......
...@@ -66,11 +66,7 @@ describe('The DAG annotations', () => { ...@@ -66,11 +66,7 @@ describe('The DAG annotations', () => {
expect(getAllTextBlocks().length).toBe(Object.keys(multiNote).length); expect(getAllTextBlocks().length).toBe(Object.keys(multiNote).length);
Object.values(multiNote).forEach((item, idx) => { Object.values(multiNote).forEach((item, idx) => {
expect( expect(getAllTextBlocks().at(idx).text()).toBe(`${item.source.name}${item.target.name}`);
getAllTextBlocks()
.at(idx)
.text(),
).toBe(`${item.source.name}${item.target.name}`);
}); });
}); });
......
...@@ -88,11 +88,7 @@ describe('The DAG graph', () => { ...@@ -88,11 +88,7 @@ describe('The DAG graph', () => {
}); });
it('renders the title as text', () => { it('renders the title as text', () => {
expect( expect(getAllLabels().at(0).text()).toBe(parsedData.nodes[0].name);
getAllLabels()
.at(0)
.text(),
).toBe(parsedData.nodes[0].name);
}); });
}); });
}); });
......
...@@ -30,7 +30,10 @@ describe('DAG visualization parsing utilities', () => { ...@@ -30,7 +30,10 @@ describe('DAG visualization parsing utilities', () => {
{ source: 'job2', target: 'job4' }, { source: 'job2', target: 'job4' },
]; ];
const dedupedLinks = [{ source: 'job1', target: 'job2' }, { source: 'job2', target: 'job4' }]; const dedupedLinks = [
{ source: 'job1', target: 'job2' },
{ source: 'job2', target: 'job4' },
];
const nodeLookup = { const nodeLookup = {
job1: { job1: {
......
...@@ -104,11 +104,9 @@ describe('graph component', () => { ...@@ -104,11 +104,9 @@ describe('graph component', () => {
}); });
it('should include the left-connector class in the build of the second child', () => { it('should include the left-connector class in the build of the second child', () => {
expect( expect(findStageColumnAt(1).find('.build:nth-child(1)').classes('left-connector')).toBe(
findStageColumnAt(1) true,
.find('.build:nth-child(1)') );
.classes('left-connector'),
).toBe(true);
}); });
it('should include the js-has-linked-pipelines flag', () => { it('should include the js-has-linked-pipelines flag', () => {
...@@ -119,12 +117,7 @@ describe('graph component', () => { ...@@ -119,12 +117,7 @@ describe('graph component', () => {
describe('computeds and methods', () => { describe('computeds and methods', () => {
describe('capitalizeStageName', () => { describe('capitalizeStageName', () => {
it('it capitalizes the stage name', () => { it('it capitalizes the stage name', () => {
expect( expect(wrapper.findAll('.stage-column .stage-name').at(1).text()).toBe('Prebuild');
wrapper
.findAll('.stage-column .stage-name')
.at(1)
.text(),
).toBe('Prebuild');
}); });
}); });
......
...@@ -47,9 +47,7 @@ describe('graph component', () => { ...@@ -47,9 +47,7 @@ describe('graph component', () => {
describe('when column requests a refresh', () => { describe('when column requests a refresh', () => {
beforeEach(() => { beforeEach(() => {
findStageColumns() findStageColumns().at(0).vm.$emit('refreshPipelineGraph');
.at(0)
.vm.$emit('refreshPipelineGraph');
}); });
it('refreshPipelineGraph is emitted', () => { it('refreshPipelineGraph is emitted', () => {
......
...@@ -40,12 +40,7 @@ describe('stage column component', () => { ...@@ -40,12 +40,7 @@ describe('stage column component', () => {
}); });
it('should render provided title', () => { it('should render provided title', () => {
expect( expect(wrapper.find('.stage-name').text().trim()).toBe('foo');
wrapper
.find('.stage-name')
.text()
.trim(),
).toBe('foo');
}); });
it('should render the provided groups', () => { it('should render the provided groups', () => {
......
...@@ -55,11 +55,7 @@ describe('Pipelines Actions dropdown', () => { ...@@ -55,11 +55,7 @@ describe('Pipelines Actions dropdown', () => {
}); });
it("renders a disabled action when it's not playable", () => { it("renders a disabled action when it's not playable", () => {
expect( expect(findAllDropdownItems().at(1).attributes('disabled')).toBe('true');
findAllDropdownItems()
.at(1)
.attributes('disabled'),
).toBe('true');
}); });
describe('on click', () => { describe('on click', () => {
...@@ -100,9 +96,7 @@ describe('Pipelines Actions dropdown', () => { ...@@ -100,9 +96,7 @@ describe('Pipelines Actions dropdown', () => {
mock.onPost(scheduledJobAction.path).reply(200); mock.onPost(scheduledJobAction.path).reply(200);
jest.spyOn(window, 'confirm').mockReturnValue(true); jest.spyOn(window, 'confirm').mockReturnValue(true);
findAllDropdownItems() findAllDropdownItems().at(0).vm.$emit('click');
.at(0)
.vm.$emit('click');
expect(window.confirm).toHaveBeenCalled(); expect(window.confirm).toHaveBeenCalled();
...@@ -115,28 +109,20 @@ describe('Pipelines Actions dropdown', () => { ...@@ -115,28 +109,20 @@ describe('Pipelines Actions dropdown', () => {
mock.onPost(scheduledJobAction.path).reply(200); mock.onPost(scheduledJobAction.path).reply(200);
jest.spyOn(window, 'confirm').mockReturnValue(false); jest.spyOn(window, 'confirm').mockReturnValue(false);
findAllDropdownItems() findAllDropdownItems().at(0).vm.$emit('click');
.at(0)
.vm.$emit('click');
expect(window.confirm).toHaveBeenCalled(); expect(window.confirm).toHaveBeenCalled();
expect(mock.history.post.length).toBe(0); expect(mock.history.post.length).toBe(0);
}); });
it('displays the remaining time in the dropdown', () => { it('displays the remaining time in the dropdown', () => {
expect( expect(findAllCountdowns().at(0).props('endDateString')).toBe(
findAllCountdowns() scheduledJobAction.scheduled_at,
.at(0) );
.props('endDateString'),
).toBe(scheduledJobAction.scheduled_at);
}); });
it('displays 00:00:00 for expired jobs in the dropdown', () => { it('displays 00:00:00 for expired jobs in the dropdown', () => {
expect( expect(findAllCountdowns().at(1).props('endDateString')).toBe(expiredJobAction.scheduled_at);
findAllCountdowns()
.at(1)
.props('endDateString'),
).toBe(expiredJobAction.scheduled_at);
}); });
}); });
}); });
...@@ -194,16 +194,8 @@ describe('Pipelines', () => { ...@@ -194,16 +194,8 @@ describe('Pipelines', () => {
}); });
it('renders empty state', () => { it('renders empty state', () => {
expect( expect(findEmptyState().find('h4').text()).toBe('Build with confidence');
findEmptyState() expect(findEmptyState().find(GlButton).attributes('href')).toBe(paths.helpPagePath);
.find('h4')
.text(),
).toBe('Build with confidence');
expect(
findEmptyState()
.find(GlButton)
.attributes('href'),
).toBe(paths.helpPagePath);
}); });
it('does not render tabs nor buttons', () => { it('does not render tabs nor buttons', () => {
...@@ -320,11 +312,7 @@ describe('Pipelines', () => { ...@@ -320,11 +312,7 @@ describe('Pipelines', () => {
'This project is not currently set up to run pipelines.', 'This project is not currently set up to run pipelines.',
); );
expect( expect(findEmptyState().find(GlButton).exists()).toBeFalsy();
findEmptyState()
.find(GlButton)
.exists(),
).toBeFalsy();
}); });
it('does not render tabs or buttons', () => { it('does not render tabs or buttons', () => {
......
...@@ -21,7 +21,10 @@ describe('Pipelines Store', () => { ...@@ -21,7 +21,10 @@ describe('Pipelines Store', () => {
}); });
it('should store the provided array', () => { it('should store the provided array', () => {
const array = [{ id: 1, status: 'running' }, { id: 2, status: 'success' }]; const array = [
{ id: 1, status: 'running' },
{ id: 2, status: 'success' },
];
store.storePipelines(array); store.storePipelines(array);
expect(store.state.pipelines).toEqual(array); expect(store.state.pipelines).toEqual(array);
......
...@@ -82,10 +82,7 @@ describe('Pipelines Table Row', () => { ...@@ -82,10 +82,7 @@ describe('Pipelines Table Row', () => {
).toEqual(pipeline.user.path); ).toEqual(pipeline.user.path);
expect( expect(
wrapper wrapper.find('.table-section:nth-child(3) .js-user-avatar-image-toolip').text().trim(),
.find('.table-section:nth-child(3) .js-user-avatar-image-toolip')
.text()
.trim(),
).toEqual(pipeline.user.name); ).toEqual(pipeline.user.name);
}); });
}); });
......
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