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