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