Commit 8b24c8d6 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 spec files: 6 of 10

Mandatory not to break master. Automatically created with prettier.
parent 86ce5406
......@@ -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/design_management/components/design_notes
spec/frontend/design_management/pages
spec/frontend/diffs/components
spec/frontend/diffs/store
spec/frontend/error_tracking/components
spec/frontend/error_tracking/store/list
spec/frontend/error_tracking_settings/components
spec/frontend/feature_flags/components
spec/frontend/filtered_search/components
spec/frontend/groups/components
spec/frontend/helpers
spec/frontend/ide/components
spec/frontend/ide/lib
spec/frontend/ide/stores
spec/frontend/incidents/components
spec/frontend/incidents_settings/components
spec/frontend/integrations/edit/components
......
......@@ -150,16 +150,8 @@ describe('Design discussions component', () => {
});
it('shows only the first note', () => {
expect(
findDesignNotes()
.at(0)
.isVisible(),
).toBe(true);
expect(
findDesignNotes()
.at(1)
.isVisible(),
).toBe(false);
expect(findDesignNotes().at(0).isVisible()).toBe(true);
expect(findDesignNotes().at(1).isVisible()).toBe(false);
});
it('renders resolved message', () => {
......@@ -193,11 +185,7 @@ describe('Design discussions component', () => {
});
it('renders the second note', () => {
expect(
findDesignNotes()
.at(1)
.isVisible(),
).toBe(true);
expect(findDesignNotes().at(1).isVisible()).toBe(true);
});
it('renders a reply placeholder', () => {
......
......@@ -545,16 +545,12 @@ describe('Design management index page', () => {
});
it('adds two designs to selected designs when their checkboxes are checked', () => {
findDesignCheckboxes()
.at(0)
.trigger('click');
findDesignCheckboxes().at(0).trigger('click');
return wrapper.vm
.$nextTick()
.then(() => {
findDesignCheckboxes()
.at(1)
.trigger('click');
findDesignCheckboxes().at(1).trigger('click');
return wrapper.vm.$nextTick();
})
......@@ -581,9 +577,7 @@ describe('Design management index page', () => {
});
it('removes all designs from selected designs when at least one design was selected', () => {
findDesignCheckboxes()
.at(0)
.trigger('click');
findDesignCheckboxes().at(0).trigger('click');
return wrapper.vm
.$nextTick()
......@@ -716,11 +710,7 @@ describe('Design management index page', () => {
await wrapper.vm.$nextTick();
expect(findDesigns()).toHaveLength(3);
expect(
findDesigns()
.at(0)
.props('id'),
).toBe('1');
expect(findDesigns().at(0).props('id')).toBe('1');
});
it('calls a mutation with correct parameters and reorders designs', async () => {
......@@ -732,11 +722,7 @@ describe('Design management index page', () => {
await wrapper.vm.$nextTick();
expect(
findDesigns()
.at(0)
.props('id'),
).toBe('2');
expect(findDesigns().at(0).props('id')).toBe('2');
});
it('prevents reordering when reorderDesigns mutation is in progress', async () => {
......
......@@ -91,12 +91,7 @@ describe('DiffDiscussions', () => {
const noteableDiscussion = wrapper.find(NoteableDiscussion);
expect(noteableDiscussion.find('.badge-pill').exists()).toBe(true);
expect(
noteableDiscussion
.find('.badge-pill')
.text()
.trim(),
).toBe('1');
expect(noteableDiscussion.find('.badge-pill').text().trim()).toBe('1');
});
});
});
......@@ -66,9 +66,7 @@ describe('DiffGutterAvatars', () => {
});
it('should emit toggleDiscussions event on avatars click', () => {
findUserAvatars()
.at(0)
.trigger('click');
findUserAvatars().at(0).trigger('click');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().toggleLineDiscussions).toBeTruthy();
......
......@@ -64,12 +64,7 @@ describe('DiffView', () => {
inline: type === 'inline',
});
expect(wrapper.findAll(DiffCommentCell).length).toBe(total);
expect(
wrapper
.find(container)
.find(DiffCommentCell)
.exists(),
).toBe(true);
expect(wrapper.find(container).find(DiffCommentCell).exists()).toBe(true);
},
);
......
......@@ -49,18 +49,8 @@ describe('Diffs image diff overlay component', () => {
createComponent();
const imageBadges = getAllImageBadges();
expect(
imageBadges
.at(0)
.text()
.trim(),
).toBe('1');
expect(
imageBadges
.at(1)
.text()
.trim(),
).toBe('2');
expect(imageBadges.at(0).text().trim()).toBe('1');
expect(imageBadges.at(1).text().trim()).toBe('2');
});
it('renders icon when showCommentIcon is true', () => {
......
......@@ -88,16 +88,8 @@ describe('Diffs tree list component', () => {
it('renders tree', () => {
expect(getFileRows()).toHaveLength(2);
expect(
getFileRows()
.at(0)
.html(),
).toContain('index.js');
expect(
getFileRows()
.at(1)
.html(),
).toContain('app');
expect(getFileRows().at(0).html()).toContain('index.js');
expect(getFileRows().at(1).html()).toContain('app');
});
it('hides file stats', () => {
......@@ -111,9 +103,7 @@ describe('Diffs tree list component', () => {
it('calls toggleTreeOpen when clicking folder', () => {
jest.spyOn(wrapper.vm.$store, 'dispatch').mockReturnValue(undefined);
getFileRows()
.at(1)
.trigger('click');
getFileRows().at(1).trigger('click');
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('diffs/toggleTreeOpen', 'app');
});
......
......@@ -272,7 +272,7 @@ describe('DiffsStoreActions', () => {
afterEach(() => mock.restore());
it('should commit SET_COVERAGE_DATA with received response', done => {
const data = { files: { 'app.js': { '1': 0, '2': 1 } } };
const data = { files: { 'app.js': { 1: 0, 2: 1 } } };
mock.onGet(endpointCoverage).reply(200, { data });
......@@ -1410,7 +1410,7 @@ describe('DiffsStoreActions', () => {
const state = { diffFiles: [{ file_hash: '123' }] };
const rootGetters = {
getDiscussion: () => ({ diff_file: { file_hash: '123' } }),
notesById: { '1': { discussion_id: '2' } },
notesById: { 1: { discussion_id: '2' } },
};
setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1');
......@@ -1423,7 +1423,7 @@ describe('DiffsStoreActions', () => {
const state = { diffFiles: [{ file_hash: '123' }] };
const rootGetters = {
getDiscussion: () => ({ id: '1' }),
notesById: { '1': { discussion_id: '2' } },
notesById: { 1: { discussion_id: '2' } },
};
setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1');
......@@ -1436,7 +1436,7 @@ describe('DiffsStoreActions', () => {
const state = { diffFiles: [{ file_hash: '123' }] };
const rootGetters = {
getDiscussion: () => ({ diff_file: { file_hash: '124' } }),
notesById: { '1': { discussion_id: '2' } },
notesById: { 1: { discussion_id: '2' } },
};
setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1');
......
......@@ -251,9 +251,12 @@ describe('Diffs Module Getters', () => {
discussionMock.diff_file.file_hash = diffFileMock.file_hash;
expect(
getters.getDiffFileDiscussions(localState, {}, {}, { discussions: [discussionMock] })(
diffFileMock,
).length,
getters.getDiffFileDiscussions(
localState,
{},
{},
{ discussions: [discussionMock] },
)(diffFileMock).length,
).toEqual(1);
});
......@@ -345,7 +348,7 @@ describe('Diffs Module Getters', () => {
describe('fileLineCoverage', () => {
beforeEach(() => {
Object.assign(localState.coverageFiles, { files: { 'app.js': { '1': 0, '2': 5 } } });
Object.assign(localState.coverageFiles, { files: { 'app.js': { 1: 0, 2: 5 } } });
});
it('returns empty object when no coverage data is available', () => {
......
......@@ -105,7 +105,7 @@ describe('DiffsStoreMutations', () => {
describe('SET_COVERAGE_DATA', () => {
it('should set coverage data properly', () => {
const state = { coverageFiles: {} };
const coverage = { 'app.js': { '1': 0, '2': 1 } };
const coverage = { 'app.js': { 1: 0, 2: 1 } };
mutations[types.SET_COVERAGE_DATA](state, coverage);
......
......@@ -41,16 +41,8 @@ describe('Error Tracking Actions', () => {
expect(findButtons().exists()).toBe(true);
return wrapper.vm.$nextTick().then(() => {
expect(
findButtons()
.at(0)
.attributes('title'),
).toBe('Ignore');
expect(
findButtons()
.at(1)
.attributes('title'),
).toBe('Resolve');
expect(findButtons().at(0).attributes('title')).toBe('Ignore');
expect(findButtons().at(1).attributes('title')).toBe('Resolve');
});
});
});
......@@ -64,11 +56,7 @@ describe('Error Tracking Actions', () => {
expect(findButtons().exists()).toBe(true);
return wrapper.vm.$nextTick().then(() => {
expect(
findButtons()
.at(0)
.attributes('title'),
).toBe('Undo Ignore');
expect(findButtons().at(0).attributes('title')).toBe('Undo Ignore');
});
});
});
......@@ -82,11 +70,7 @@ describe('Error Tracking Actions', () => {
expect(findButtons().exists()).toBe(true);
return wrapper.vm.$nextTick().then(() => {
expect(
findButtons()
.at(1)
.attributes('title'),
).toBe('Unresolve');
expect(findButtons().at(1).attributes('title')).toBe('Unresolve');
});
});
});
......
......@@ -19,18 +19,9 @@ describe('ErrorTrackingList', () => {
const findErrorListTable = () => wrapper.find('table');
const findErrorListRows = () => wrapper.findAll('tbody tr');
const dropdownsArray = () => wrapper.findAll(GlDropdown);
const findRecentSearchesDropdown = () =>
dropdownsArray()
.at(0)
.find(GlDropdown);
const findStatusFilterDropdown = () =>
dropdownsArray()
.at(1)
.find(GlDropdown);
const findSortDropdown = () =>
dropdownsArray()
.at(2)
.find(GlDropdown);
const findRecentSearchesDropdown = () => dropdownsArray().at(0).find(GlDropdown);
const findStatusFilterDropdown = () => dropdownsArray().at(1).find(GlDropdown);
const findSortDropdown = () => dropdownsArray().at(2).find(GlDropdown);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findPagination = () => wrapper.find(GlPagination);
const findErrorActions = () => wrapper.find(ErrorTrackingActions);
......
......@@ -48,7 +48,10 @@ describe('error tracking actions', () => {
actions.startPolling,
{},
{},
[{ 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(createFlash).toHaveBeenCalledTimes(1);
......@@ -64,7 +67,10 @@ describe('error tracking actions', () => {
actions.restartPolling,
{},
{},
[{ type: types.SET_ERRORS, payload: [] }, { type: types.SET_LOADING, payload: true }],
[
{ type: types.SET_ERRORS, payload: [] },
{ type: types.SET_LOADING, payload: true },
],
[],
);
});
......@@ -110,7 +116,10 @@ describe('error tracking actions', () => {
actions.sortByField,
field,
{},
[{ type: types.SET_CURSOR, payload: null }, { type: types.SET_SORT_FIELD, payload: field }],
[
{ type: types.SET_CURSOR, payload: null },
{ type: types.SET_SORT_FIELD, payload: field },
],
[{ type: 'stopPolling' }, { type: 'startPolling' }],
);
});
......
......@@ -35,12 +35,7 @@ describe('error tracking settings form', () => {
it('is rendered', () => {
expect(wrapper.findAll(GlFormInput).length).toBe(2);
expect(wrapper.find(GlFormInput).attributes('id')).toBe('error-tracking-api-host');
expect(
wrapper
.findAll(GlFormInput)
.at(1)
.attributes('id'),
).toBe('error-tracking-token');
expect(wrapper.findAll(GlFormInput).at(1).attributes('id')).toBe('error-tracking-token');
expect(wrapper.findAll(GlButton).exists()).toBe(true);
});
......@@ -56,12 +51,9 @@ describe('error tracking settings form', () => {
);
expect(pageText).not.toContain('Connection has failed. Re-check Auth Token and try again');
expect(
wrapper
.findAll(GlFormInput)
.at(0)
.attributes('placeholder'),
).toContain('https://mysentryserver.com');
expect(wrapper.findAll(GlFormInput).at(0).attributes('placeholder')).toContain(
'https://mysentryserver.com',
);
});
});
......
......@@ -136,10 +136,7 @@ describe('Feature flags > Environments dropdown ', () => {
});
it('emits create event', async () => {
wrapper
.findAll(GlButton)
.at(0)
.vm.$emit('click');
wrapper.findAll(GlButton).at(0).vm.$emit('click');
await wrapper.vm.$nextTick();
expect(wrapper.emitted('createClicked')).toEqual([['production']]);
});
......
......@@ -101,11 +101,9 @@ describe('Feature flags', () => {
it('shows a feature flags limit reached alert', () => {
expect(limitAlert().exists()).toBe(true);
expect(
limitAlert()
.find(GlSprintf)
.attributes('message'),
).toContain('Feature flags limit reached');
expect(limitAlert().find(GlSprintf).attributes('message')).toContain(
'Feature flags limit reached',
);
});
describe('when the alert is dismissed', () => {
......
......@@ -347,10 +347,7 @@ describe('feature flag form', () => {
return wrapper.vm.$nextTick();
})
.then(() => {
wrapper
.find('.js-add-new-scope')
.find(ToggleButton)
.vm.$emit('change', true);
wrapper.find('.js-add-new-scope').find(ToggleButton).vm.$emit('change', true);
})
.then(() => {
wrapper.find(ToggleButton).vm.$emit('change', true);
......
......@@ -84,18 +84,11 @@ describe('Recent Searches Dropdown Content', () => {
});
it('expect second dropdown to have 2 tokens', () => {
expect(
findDropdownItems()
.at(1)
.findAll('.js-dropdown-token'),
).toHaveLength(2);
expect(findDropdownItems().at(1).findAll('.js-dropdown-token')).toHaveLength(2);
});
it('emits recentSearchesItemSelected on dropdown item click', () => {
findDropdownItems()
.at(0)
.find('.js-dropdown-button')
.trigger('click');
findDropdownItems().at(0).find('.js-dropdown-button').trigger('click');
expect(onRecentSearchesItemSelectedSpy).toHaveBeenCalledWith('foo');
});
......
......@@ -56,10 +56,7 @@ describe('Visibility Level Dropdown', () => {
describe('Selecting an option', () => {
beforeEach(() => {
wrapper
.findAll(GlDropdownItem)
.at(1)
.vm.$emit('click');
wrapper.findAll(GlDropdownItem).at(1).vm.$emit('click');
});
it('sets the value of the hidden input to the selected value', () => {
......
......@@ -3,7 +3,11 @@ import { getSeriesLabel, makeDataSeries } from '~/helpers/monitor_helper';
describe('monitor helper', () => {
const defaultConfig = { default: true, name: 'default name' };
const name = 'data name';
const series = [[1, 1], [2, 2], [3, 3]];
const series = [
[1, 1],
[2, 2],
[3, 3],
];
describe('getSeriesLabel', () => {
const metricAttributes = { __name__: 'up', app: 'prometheus' };
......
......@@ -2,12 +2,7 @@ let id = 1;
// Code taken from: https://gist.github.com/6174/6062387
const getRandomString = () =>
Math.random()
.toString(36)
.substring(2, 15) +
Math.random()
.toString(36)
.substring(2, 15);
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
const getRandomUrl = () => `https://${getRandomString()}.com/${getRandomString()}`;
......
......@@ -45,15 +45,16 @@ describe('IDE extra file row component', () => {
expect(vm.folderChangesTooltip).toBe(undefined);
});
[{ input: 1, output: '1 changed file' }, { input: 2, output: '2 changed files' }].forEach(
({ input, output }) => {
it('returns changed files count if changes count is not 0', () => {
changesCount = input;
expect(vm.folderChangesTooltip).toBe(output);
});
},
);
[
{ input: 1, output: '1 changed file' },
{ input: 2, output: '2 changed files' },
].forEach(({ input, output }) => {
it('returns changed files count if changes count is not 0', () => {
changesCount = input;
expect(vm.folderChangesTooltip).toBe(output);
});
});
});
describe('show tree changes count', () => {
......
......@@ -67,10 +67,7 @@ describe('IDE file templates bar component', () => {
it('calls fetchTemplate on click', () => {
jest.spyOn(vm, 'fetchTemplate').mockImplementation();
vm.$el
.querySelectorAll('.dropdown-content')[1]
.querySelector('button')
.click();
vm.$el.querySelectorAll('.dropdown-content')[1].querySelector('button').click();
expect(vm.fetchTemplate).toHaveBeenCalledWith({
name: 'test',
......
......@@ -58,10 +58,7 @@ describe('ide/components/ide_sidebar_nav', () => {
tooltip: getBinding(button.element, 'tooltip').value,
};
});
const clickTab = () =>
findButtons()
.at(TEST_CURRENT_INDEX)
.trigger('click');
const clickTab = () => findButtons().at(TEST_CURRENT_INDEX).trigger('click');
describe.each`
isOpen | side | otherSide | classes | classesObj | emitEvent | emitArg
......
......@@ -60,10 +60,7 @@ describe('IDE pipeline stage', () => {
it('emits clickViewLog entity with job', () => {
const [job] = defaultProps.stage.jobs;
createComponent();
wrapper
.findAll(Item)
.at(0)
.vm.$emit('clickViewLog', job);
wrapper.findAll(Item).at(0).vm.$emit('clickViewLog', job);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().clickViewLog[0][0]).toBe(job);
});
......
......@@ -82,9 +82,7 @@ describe('IDE merge requests list', () => {
return wrapper.vm
.$nextTick()
.then(() => {
findSearchTypeButtons()
.at(0)
.trigger('click');
findSearchTypeButtons().at(0).trigger('click');
return wrapper.vm.$nextTick();
})
.then(() => {
......@@ -168,9 +166,7 @@ describe('IDE merge requests list', () => {
describe('with search type', () => {
beforeEach(() => {
findSearchTypeButtons()
.at(0)
.trigger('click');
findSearchTypeButtons().at(0).trigger('click');
return wrapper.vm
.$nextTick()
......
......@@ -165,11 +165,7 @@ describe('IDE pipelines list', () => {
const isLoadingJobs = true;
createComponent({}, { ...withLatestPipelineState, stages, isLoadingJobs });
const jobProps = wrapper
.findAll(GlTab)
.at(0)
.find(JobsList)
.props();
const jobProps = wrapper.findAll(GlTab).at(0).find(JobsList).props();
expect(jobProps.stages).toBe(stages);
expect(jobProps.loading).toBe(isLoadingJobs);
});
......@@ -180,11 +176,7 @@ describe('IDE pipelines list', () => {
const isLoadingJobs = true;
createComponent({}, { ...withLatestPipelineState, isLoadingJobs });
const jobProps = wrapper
.findAll(GlTab)
.at(1)
.find(JobsList)
.props();
const jobProps = wrapper.findAll(GlTab).at(1).find(JobsList).props();
expect(jobProps.stages).toBe(failedStages);
expect(jobProps.loading).toBe(isLoadingJobs);
});
......
......@@ -77,18 +77,8 @@ describe('RepoCommitSection', () => {
});
it('renders no changes text', () => {
expect(
wrapper
.find(EmptyState)
.text()
.trim(),
).toContain('No changes');
expect(
wrapper
.find(EmptyState)
.find('img')
.attributes('src'),
).toBe(TEST_NO_CHANGES_SVG);
expect(wrapper.find(EmptyState).text().trim()).toContain('No changes');
expect(wrapper.find(EmptyState).find('img').attributes('src')).toBe(TEST_NO_CHANGES_SVG);
});
});
......
......@@ -21,11 +21,7 @@ const spliceLines = (content, lineNumber, deleteCount = 0, newLines = []) => {
return lines.join('\n');
};
const mapLines = (content, mapFn) =>
content
.split('\n')
.map(mapFn)
.join('\n');
const mapLines = (content, mapFn) => content.split('\n').map(mapFn).join('\n');
describe('IDE lib/create_file_diff', () => {
it('returns empty string with "garbage" action', () => {
......
......@@ -71,7 +71,7 @@ describe('IDE store merge request actions', () => {
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
expect(store.state.projects.abcproject.mergeRequests).toEqual({
'2': expect.objectContaining(mrData),
2: expect.objectContaining(mrData),
});
done();
})
......
......@@ -456,9 +456,7 @@ describe('IDE commit module actions', () => {
.dispatch('commit/commitChanges')
.then(() => {
expect(visitUrl).toHaveBeenCalledWith(
`webUrl/-/merge_requests/new?merge_request[source_branch]=${
store.getters['commit/placeholderBranchName']
}&merge_request[target_branch]=master&nav_source=webide`,
`webUrl/-/merge_requests/new?merge_request[source_branch]=${store.getters['commit/placeholderBranchName']}&merge_request[target_branch]=master&nav_source=webide`,
);
done();
......
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