Commit 52907ac2 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 65 of 73

Part of our prettier migration; changing the arrow-parens style.
parent d4a8b730
export const resetStore = store => { export const resetStore = (store) => {
store.replaceState({ store.replaceState({
notes: [], notes: [],
targetNoteHash: null, targetNoteHash: null,
......
...@@ -34,7 +34,7 @@ describe('Discussion navigation mixin', () => { ...@@ -34,7 +34,7 @@ describe('Discussion navigation mixin', () => {
setHTMLFixture( setHTMLFixture(
[...'abcde'] [...'abcde']
.map( .map(
id => (id) =>
`<ul class="notes" data-discussion-id="${id}"></ul> `<ul class="notes" data-discussion-id="${id}"></ul>
<div class="discussion" data-discussion-id="${id}"></div>`, <div class="discussion" data-discussion-id="${id}"></div>`,
) )
......
...@@ -127,7 +127,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -127,7 +127,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
jest.spyOn(notes, 'renderNote'); jest.spyOn(notes, 'renderNote');
$('.js-comment-button').on('click', e => { $('.js-comment-button').on('click', (e) => {
const $form = $(this); const $form = $(this);
e.preventDefault(); e.preventDefault();
notes.addNote($form, {}); notes.addNote($form, {});
...@@ -550,7 +550,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -550,7 +550,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
expect($notesContainer.find('.note.being-posted').length).toBeGreaterThan(0); expect($notesContainer.find('.note.being-posted').length).toBeGreaterThan(0);
}); });
it('should remove placeholder note when new comment is done posting', done => { it('should remove placeholder note when new comment is done posting', (done) => {
mockNotesPost(); mockNotesPost();
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -562,7 +562,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -562,7 +562,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
describe('postComment', () => { describe('postComment', () => {
it('disables the submit button', done => { it('disables the submit button', (done) => {
const $submitButton = $form.find('.js-comment-submit-button'); const $submitButton = $form.find('.js-comment-submit-button');
expect($submitButton).not.toBeDisabled(); expect($submitButton).not.toBeDisabled();
...@@ -585,7 +585,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -585,7 +585,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
}); });
it('should show actual note element when new comment is done posting', done => { it('should show actual note element when new comment is done posting', (done) => {
mockNotesPost(); mockNotesPost();
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -596,7 +596,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -596,7 +596,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
}); });
it('should reset Form when new comment is done posting', done => { it('should reset Form when new comment is done posting', (done) => {
mockNotesPost(); mockNotesPost();
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -607,7 +607,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -607,7 +607,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
}); });
}); });
it('should show flash error message when new comment failed to be posted', done => { it('should show flash error message when new comment failed to be posted', (done) => {
mockNotesPostError(); mockNotesPostError();
jest.spyOn(notes, 'addFlash'); jest.spyOn(notes, 'addFlash');
...@@ -658,7 +658,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -658,7 +658,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$form.find('textarea.js-note-text').val(sampleComment); $form.find('textarea.js-note-text').val(sampleComment);
}); });
it('should remove quick action placeholder when comment with quick actions is done posting', done => { it('should remove quick action placeholder when comment with quick actions is done posting', (done) => {
jest.spyOn(gl.awardsHandler, 'addAwardToEmojiBar'); jest.spyOn(gl.awardsHandler, 'addAwardToEmojiBar');
$('.js-comment-button').click(); $('.js-comment-button').click();
...@@ -693,7 +693,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -693,7 +693,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$form.find('textarea.js-note-text').val(sampleComment); $form.find('textarea.js-note-text').val(sampleComment);
}); });
it('should show message placeholder including lines starting with slash', done => { it('should show message placeholder including lines starting with slash', (done) => {
$('.js-comment-button').click(); $('.js-comment-button').click();
expect($notesContainer.find('.note.being-posted').length).toEqual(1); // Placeholder shown expect($notesContainer.find('.note.being-posted').length).toEqual(1); // Placeholder shown
...@@ -731,7 +731,7 @@ describe.skip('Old Notes (~/notes.js)', () => { ...@@ -731,7 +731,7 @@ describe.skip('Old Notes (~/notes.js)', () => {
$form.find('textarea.js-note-text').html(sampleComment); $form.find('textarea.js-note-text').html(sampleComment);
}); });
it('should not render a script tag', done => { it('should not render a script tag', (done) => {
$('.js-comment-button').click(); $('.js-comment-button').click();
setImmediate(() => { setImmediate(() => {
......
This diff is collapsed.
...@@ -72,7 +72,7 @@ describe('Getters Notes Store', () => { ...@@ -72,7 +72,7 @@ describe('Getters Notes Store', () => {
state.isTimelineEnabled = true; state.isTimelineEnabled = true;
expect(getters.discussions(state).length).toEqual(discussionMock.notes.length); expect(getters.discussions(state).length).toEqual(discussionMock.notes.length);
getters.discussions(state).forEach(discussion => { getters.discussions(state).forEach((discussion) => {
expect(discussion.individual_note).toBe(true); expect(discussion.individual_note).toBe(true);
expect(discussion.id).toBe(discussion.notes[0].id); expect(discussion.id).toBe(discussion.notes[0].id);
expect(discussion.created_at).toBe(discussion.notes[0].created_at); expect(discussion.created_at).toBe(discussion.notes[0].created_at);
......
...@@ -357,7 +357,7 @@ describe('Notes Store mutations', () => { ...@@ -357,7 +357,7 @@ describe('Notes Store mutations', () => {
mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: true }); mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: true });
state.discussions.forEach(discussion => { state.discussions.forEach((discussion) => {
expect(discussion.expanded).toEqual(true); expect(discussion.expanded).toEqual(true);
}); });
}); });
...@@ -371,7 +371,7 @@ describe('Notes Store mutations', () => { ...@@ -371,7 +371,7 @@ describe('Notes Store mutations', () => {
mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: false }); mutations.SET_EXPAND_DISCUSSIONS(state, { discussionIds, expanded: false });
state.discussions.forEach(discussion => { state.discussions.forEach((discussion) => {
expect(discussion.expanded).toEqual(false); expect(discussion.expanded).toEqual(false);
}); });
}); });
...@@ -698,7 +698,7 @@ describe('Notes Store mutations', () => { ...@@ -698,7 +698,7 @@ describe('Notes Store mutations', () => {
}); });
describe('SET_APPLYING_BATCH_STATE', () => { describe('SET_APPLYING_BATCH_STATE', () => {
const buildDiscussions = suggestionsInfo => { const buildDiscussions = (suggestionsInfo) => {
const suggestions = suggestionsInfo.map(({ suggestionId }) => ({ id: suggestionId })); const suggestions = suggestionsInfo.map(({ suggestionId }) => ({ id: suggestionId }));
const notes = suggestionsInfo.map(({ noteId }, index) => ({ const notes = suggestionsInfo.map(({ noteId }, index) => ({
...@@ -738,7 +738,7 @@ describe('Notes Store mutations', () => { ...@@ -738,7 +738,7 @@ describe('Notes Store mutations', () => {
const expectedSuggestions = [updatedSuggestion, suggestions[1]]; const expectedSuggestions = [updatedSuggestion, suggestions[1]];
const actualSuggestions = state.discussions const actualSuggestions = state.discussions
.map(discussion => discussion.notes.map(n => n.suggestions)) .map((discussion) => discussion.notes.map((n) => n.suggestions))
.flat(2); .flat(2);
expect(actualSuggestions).toEqual(expectedSuggestions); expect(actualSuggestions).toEqual(expectedSuggestions);
......
...@@ -2,7 +2,7 @@ import $ from 'jquery'; ...@@ -2,7 +2,7 @@ import $ from 'jquery';
import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me'; import OAuthRememberMe from '~/pages/sessions/new/oauth_remember_me';
describe('OAuthRememberMe', () => { describe('OAuthRememberMe', () => {
const findFormAction = selector => { const findFormAction = (selector) => {
return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action'); return $(`#oauth-container .oauth-login${selector}`).parent('form').attr('action');
}; };
......
...@@ -11,7 +11,7 @@ describe('Package Additional Metadata', () => { ...@@ -11,7 +11,7 @@ describe('Package Additional Metadata', () => {
packageEntity: { ...mavenPackage }, packageEntity: { ...mavenPackage },
}; };
const mountComponent = props => { const mountComponent = (props) => {
wrapper = shallowMount(component, { wrapper = shallowMount(component, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
stubs: { stubs: {
...@@ -33,7 +33,7 @@ describe('Package Additional Metadata', () => { ...@@ -33,7 +33,7 @@ describe('Package Additional Metadata', () => {
const findConanRecipe = () => wrapper.find('[data-testid="conan-recipe"]'); const findConanRecipe = () => wrapper.find('[data-testid="conan-recipe"]');
const findMavenApp = () => wrapper.find('[data-testid="maven-app"]'); const findMavenApp = () => wrapper.find('[data-testid="maven-app"]');
const findMavenGroup = () => wrapper.find('[data-testid="maven-group"]'); const findMavenGroup = () => wrapper.find('[data-testid="maven-group"]');
const findElementLink = container => container.find(GlLink); const findElementLink = (container) => container.find(GlLink);
it('has the correct title', () => { it('has the correct title', () => {
mountComponent(); mountComponent();
......
...@@ -15,10 +15,10 @@ describe('Package History', () => { ...@@ -15,10 +15,10 @@ describe('Package History', () => {
packageEntity: { ...mavenPackage }, packageEntity: { ...mavenPackage },
}; };
const createPipelines = amount => const createPipelines = (amount) =>
[...Array(amount)].map((x, index) => ({ ...mockPipelineInfo, id: index + 1 })); [...Array(amount)].map((x, index) => ({ ...mockPipelineInfo, id: index + 1 }));
const mountComponent = props => { const mountComponent = (props) => {
wrapper = shallowMount(component, { wrapper = shallowMount(component, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
stubs: { stubs: {
...@@ -35,9 +35,9 @@ describe('Package History', () => { ...@@ -35,9 +35,9 @@ describe('Package History', () => {
wrapper = null; wrapper = null;
}); });
const findHistoryElement = testId => wrapper.find(`[data-testid="${testId}"]`); const findHistoryElement = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const findElementLink = container => container.find(GlLink); const findElementLink = (container) => container.find(GlLink);
const findElementTimeAgo = container => container.find(TimeAgoTooltip); const findElementTimeAgo = (container) => container.find(TimeAgoTooltip);
const findTitle = () => wrapper.find('[data-testid="title"]'); const findTitle = () => wrapper.find('[data-testid="title"]');
const findTimeline = () => wrapper.find('[data-testid="timeline"]'); const findTimeline = () => wrapper.find('[data-testid="timeline"]');
......
...@@ -12,7 +12,7 @@ jest.mock('~/api.js'); ...@@ -12,7 +12,7 @@ jest.mock('~/api.js');
describe('Actions Package details store', () => { describe('Actions Package details store', () => {
describe('fetchPackageVersions', () => { describe('fetchPackageVersions', () => {
it('should fetch the package versions', done => { it('should fetch the package versions', (done) => {
Api.projectPackage = jest.fn().mockResolvedValue({ data: packageEntity }); Api.projectPackage = jest.fn().mockResolvedValue({ data: packageEntity });
testAction( testAction(
...@@ -35,7 +35,7 @@ describe('Actions Package details store', () => { ...@@ -35,7 +35,7 @@ describe('Actions Package details store', () => {
); );
}); });
it("does not set the versions if they don't exist", done => { it("does not set the versions if they don't exist", (done) => {
Api.projectPackage = jest.fn().mockResolvedValue({ data: { packageEntity, versions: null } }); Api.projectPackage = jest.fn().mockResolvedValue({ data: { packageEntity, versions: null } });
testAction( testAction(
...@@ -57,7 +57,7 @@ describe('Actions Package details store', () => { ...@@ -57,7 +57,7 @@ describe('Actions Package details store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
Api.projectPackage = jest.fn().mockRejectedValue(); Api.projectPackage = jest.fn().mockRejectedValue();
testAction( testAction(
...@@ -82,7 +82,7 @@ describe('Actions Package details store', () => { ...@@ -82,7 +82,7 @@ describe('Actions Package details store', () => {
}); });
describe('deletePackage', () => { describe('deletePackage', () => {
it('should call Api.deleteProjectPackage', done => { it('should call Api.deleteProjectPackage', (done) => {
Api.deleteProjectPackage = jest.fn().mockResolvedValue(); Api.deleteProjectPackage = jest.fn().mockResolvedValue();
testAction(deletePackage, undefined, { packageEntity }, [], [], () => { testAction(deletePackage, undefined, { packageEntity }, [], [], () => {
expect(Api.deleteProjectPackage).toHaveBeenCalledWith( expect(Api.deleteProjectPackage).toHaveBeenCalledWith(
...@@ -92,7 +92,7 @@ describe('Actions Package details store', () => { ...@@ -92,7 +92,7 @@ describe('Actions Package details store', () => {
done(); done();
}); });
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
Api.deleteProjectPackage = jest.fn().mockRejectedValue(); Api.deleteProjectPackage = jest.fn().mockRejectedValue();
testAction(deletePackage, undefined, { packageEntity }, [], [], () => { testAction(deletePackage, undefined, { packageEntity }, [], [], () => {
......
...@@ -16,7 +16,7 @@ describe('packages_sort', () => { ...@@ -16,7 +16,7 @@ describe('packages_sort', () => {
const findPackageListSorting = () => wrapper.find(GlSorting); const findPackageListSorting = () => wrapper.find(GlSorting);
const findSortingItems = () => wrapper.findAll(GlSortingItem); const findSortingItems = () => wrapper.findAll(GlSortingItem);
const createStore = isGroupPage => { const createStore = (isGroupPage) => {
const state = { const state = {
config: { config: {
isGroupPage, isGroupPage,
......
...@@ -30,7 +30,7 @@ describe('Actions Package list store', () => { ...@@ -30,7 +30,7 @@ describe('Actions Package list store', () => {
sort: 'asc', sort: 'asc',
orderBy: 'version', orderBy: 'version',
}; };
it('should fetch the project packages list when isGroupPage is false', done => { it('should fetch the project packages list when isGroupPage is false', (done) => {
testAction( testAction(
actions.requestPackagesList, actions.requestPackagesList,
undefined, undefined,
...@@ -50,7 +50,7 @@ describe('Actions Package list store', () => { ...@@ -50,7 +50,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should fetch the group packages list when isGroupPage is true', done => { it('should fetch the group packages list when isGroupPage is true', (done) => {
testAction( testAction(
actions.requestPackagesList, actions.requestPackagesList,
undefined, undefined,
...@@ -70,7 +70,7 @@ describe('Actions Package list store', () => { ...@@ -70,7 +70,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should fetch packages of a certain type when selectedType is present', done => { it('should fetch packages of a certain type when selectedType is present', (done) => {
const packageType = 'maven'; const packageType = 'maven';
testAction( testAction(
...@@ -102,7 +102,7 @@ describe('Actions Package list store', () => { ...@@ -102,7 +102,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should create flash on API error', done => { it('should create flash on API error', (done) => {
Api.projectPackages = jest.fn().mockRejectedValue(); Api.projectPackages = jest.fn().mockRejectedValue();
testAction( testAction(
actions.requestPackagesList, actions.requestPackagesList,
...@@ -122,7 +122,7 @@ describe('Actions Package list store', () => { ...@@ -122,7 +122,7 @@ describe('Actions Package list store', () => {
}); });
describe('receivePackagesListSuccess', () => { describe('receivePackagesListSuccess', () => {
it('should set received packages', done => { it('should set received packages', (done) => {
const data = 'foo'; const data = 'foo';
testAction( testAction(
...@@ -140,7 +140,7 @@ describe('Actions Package list store', () => { ...@@ -140,7 +140,7 @@ describe('Actions Package list store', () => {
}); });
describe('setInitialState', () => { describe('setInitialState', () => {
it('should commit setInitialState', done => { it('should commit setInitialState', (done) => {
testAction( testAction(
actions.setInitialState, actions.setInitialState,
'1', '1',
...@@ -153,7 +153,7 @@ describe('Actions Package list store', () => { ...@@ -153,7 +153,7 @@ describe('Actions Package list store', () => {
}); });
describe('setLoading', () => { describe('setLoading', () => {
it('should commit set main loading', done => { it('should commit set main loading', (done) => {
testAction( testAction(
actions.setLoading, actions.setLoading,
true, true,
...@@ -171,7 +171,7 @@ describe('Actions Package list store', () => { ...@@ -171,7 +171,7 @@ describe('Actions Package list store', () => {
delete_api_path: 'foo', delete_api_path: 'foo',
}, },
}; };
it('should perform a delete operation on _links.delete_api_path', done => { it('should perform a delete operation on _links.delete_api_path', (done) => {
mock.onDelete(payload._links.delete_api_path).replyOnce(200); mock.onDelete(payload._links.delete_api_path).replyOnce(200);
Api.projectPackages = jest.fn().mockResolvedValue({ data: 'foo' }); Api.projectPackages = jest.fn().mockResolvedValue({ data: 'foo' });
...@@ -188,7 +188,7 @@ describe('Actions Package list store', () => { ...@@ -188,7 +188,7 @@ describe('Actions Package list store', () => {
); );
}); });
it('should stop the loading and call create flash on api error', done => { it('should stop the loading and call create flash on api error', (done) => {
mock.onDelete(payload._links.delete_api_path).replyOnce(400); mock.onDelete(payload._links.delete_api_path).replyOnce(400);
testAction( testAction(
actions.requestDeletePackage, actions.requestDeletePackage,
...@@ -211,7 +211,7 @@ describe('Actions Package list store', () => { ...@@ -211,7 +211,7 @@ describe('Actions Package list store', () => {
${'_links'} | ${{}} ${'_links'} | ${{}}
${'delete_api_path'} | ${{ _links: {} }} ${'delete_api_path'} | ${{ _links: {} }}
`('should reject and createFlash when $property is missing', ({ actionPayload }, done) => { `('should reject and createFlash when $property is missing', ({ actionPayload }, done) => {
testAction(actions.requestDeletePackage, actionPayload, null, [], []).catch(e => { testAction(actions.requestDeletePackage, actionPayload, null, [], []).catch((e) => {
expect(e).toEqual(new Error(MISSING_DELETE_PATH_ERROR)); expect(e).toEqual(new Error(MISSING_DELETE_PATH_ERROR));
expect(createFlash).toHaveBeenCalledWith(DELETE_PACKAGE_ERROR_MESSAGE); expect(createFlash).toHaveBeenCalledWith(DELETE_PACKAGE_ERROR_MESSAGE);
done(); done();
...@@ -220,7 +220,7 @@ describe('Actions Package list store', () => { ...@@ -220,7 +220,7 @@ describe('Actions Package list store', () => {
}); });
describe('setSorting', () => { describe('setSorting', () => {
it('should commit SET_SORTING', done => { it('should commit SET_SORTING', (done) => {
testAction( testAction(
actions.setSorting, actions.setSorting,
'foo', 'foo',
...@@ -233,7 +233,7 @@ describe('Actions Package list store', () => { ...@@ -233,7 +233,7 @@ describe('Actions Package list store', () => {
}); });
describe('setFilter', () => { describe('setFilter', () => {
it('should commit SET_FILTER', done => { it('should commit SET_FILTER', (done) => {
testAction( testAction(
actions.setFilter, actions.setFilter,
'foo', 'foo',
......
...@@ -21,8 +21,8 @@ describe('PackagePath', () => { ...@@ -21,8 +21,8 @@ describe('PackagePath', () => {
const ELLIPSIS_CHEVRON = 'ellipsis-chevron'; const ELLIPSIS_CHEVRON = 'ellipsis-chevron';
const LEAF_LINK = 'leaf-link'; const LEAF_LINK = 'leaf-link';
const findItem = name => wrapper.find(`[data-testid="${name}"]`); const findItem = (name) => wrapper.find(`[data-testid="${name}"]`);
const findTooltip = w => getBinding(w.element, 'gl-tooltip'); const findTooltip = (w) => getBinding(w.element, 'gl-tooltip');
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -64,13 +64,13 @@ describe('PackagePath', () => { ...@@ -64,13 +64,13 @@ describe('PackagePath', () => {
} }
if (shouldExist.length) { if (shouldExist.length) {
it.each(shouldExist)(`should have %s`, element => { it.each(shouldExist)(`should have %s`, (element) => {
expect(findItem(element).exists()).toBe(true); expect(findItem(element).exists()).toBe(true);
}); });
} }
if (shouldNotExist.length) { if (shouldNotExist.length) {
it.each(shouldNotExist)(`should not have %s`, element => { it.each(shouldNotExist)(`should not have %s`, (element) => {
expect(findItem(element).exists()).toBe(false); expect(findItem(element).exists()).toBe(false);
}); });
} }
......
...@@ -13,7 +13,7 @@ describe('Packages shared utils', () => { ...@@ -13,7 +13,7 @@ describe('Packages shared utils', () => {
expect(packageTypeToTrackCategory()).toMatchInlineSnapshot(`"UI::undefined"`); expect(packageTypeToTrackCategory()).toMatchInlineSnapshot(`"UI::undefined"`);
}); });
it.each(Object.keys(PackageType))('returns a correct category string for %s', packageKey => { it.each(Object.keys(PackageType))('returns a correct category string for %s', (packageKey) => {
const packageName = PackageType[packageKey]; const packageName = PackageType[packageKey];
expect(packageTypeToTrackCategory(packageName)).toBe( expect(packageTypeToTrackCategory(packageName)).toBe(
`UI::${TrackingCategories[packageName]}`, `UI::${TrackingCategories[packageName]}`,
......
...@@ -89,7 +89,7 @@ describe('pager', () => { ...@@ -89,7 +89,7 @@ describe('pager', () => {
Pager.init(); Pager.init();
}); });
it('shows loader while loading next page', done => { it('shows loader while loading next page', (done) => {
mockSuccess(); mockSuccess();
jest.spyOn(Pager.loading, 'show').mockImplementation(() => {}); jest.spyOn(Pager.loading, 'show').mockImplementation(() => {});
...@@ -102,7 +102,7 @@ describe('pager', () => { ...@@ -102,7 +102,7 @@ describe('pager', () => {
}); });
}); });
it('hides loader on success', done => { it('hides loader on success', (done) => {
mockSuccess(); mockSuccess();
jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {}); jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {});
...@@ -115,7 +115,7 @@ describe('pager', () => { ...@@ -115,7 +115,7 @@ describe('pager', () => {
}); });
}); });
it('hides loader on error', done => { it('hides loader on error', (done) => {
mockError(); mockError();
jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {}); jest.spyOn(Pager.loading, 'hide').mockImplementation(() => {});
...@@ -128,7 +128,7 @@ describe('pager', () => { ...@@ -128,7 +128,7 @@ describe('pager', () => {
}); });
}); });
it('sends request to url with offset and limit params', done => { it('sends request to url with offset and limit params', (done) => {
Pager.offset = 100; Pager.offset = 100;
Pager.limit = 20; Pager.limit = 20;
Pager.getOld(); Pager.getOld();
...@@ -149,7 +149,7 @@ describe('pager', () => { ...@@ -149,7 +149,7 @@ describe('pager', () => {
}); });
}); });
it('disables if return count is less than limit', done => { it('disables if return count is less than limit', (done) => {
Pager.offset = 0; Pager.offset = 0;
Pager.limit = 20; Pager.limit = 20;
......
...@@ -8,10 +8,10 @@ describe('Abuse Reports', () => { ...@@ -8,10 +8,10 @@ describe('Abuse Reports', () => {
let $messages; let $messages;
const assertMaxLength = $message => { const assertMaxLength = ($message) => {
expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH); expect($message.text().length).toEqual(MAX_MESSAGE_LENGTH);
}; };
const findMessage = searchText => const findMessage = (searchText) =>
$messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first(); $messages.filter((index, element) => element.innerText.indexOf(searchText) > -1).first();
preloadFixtures(FIXTURE); preloadFixtures(FIXTURE);
......
...@@ -24,7 +24,7 @@ describe('AccountAndLimits', () => { ...@@ -24,7 +24,7 @@ describe('AccountAndLimits', () => {
expect($userInternalRegex.readOnly).toBeTruthy(); expect($userInternalRegex.readOnly).toBeTruthy();
}); });
it('is checked', done => { it('is checked', (done) => {
if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click(); if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click();
expect($userDefaultExternal.prop('checked')).toBeTruthy(); expect($userDefaultExternal.prop('checked')).toBeTruthy();
......
...@@ -26,9 +26,9 @@ describe('stop_jobs_modal.vue', () => { ...@@ -26,9 +26,9 @@ describe('stop_jobs_modal.vue', () => {
}); });
describe('onSubmit', () => { describe('onSubmit', () => {
it('stops jobs and redirects to overview page', done => { it('stops jobs and redirects to overview page', (done) => {
const responseURL = `${TEST_HOST}/stop_jobs_modal.vue/jobs`; const responseURL = `${TEST_HOST}/stop_jobs_modal.vue/jobs`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(props.url); expect(url).toBe(props.url);
return Promise.resolve({ return Promise.resolve({
request: { request: {
...@@ -45,16 +45,16 @@ describe('stop_jobs_modal.vue', () => { ...@@ -45,16 +45,16 @@ describe('stop_jobs_modal.vue', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays error if stopping jobs failed', done => { it('displays error if stopping jobs failed', (done) => {
const dummyError = new Error('stopping jobs failed'); const dummyError = new Error('stopping jobs failed');
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(props.url); expect(url).toBe(props.url);
return Promise.reject(dummyError); return Promise.reject(dummyError);
}); });
vm.onSubmit() vm.onSubmit()
.then(done.fail) .then(done.fail)
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(redirectTo).not.toHaveBeenCalled(); expect(redirectTo).not.toHaveBeenCalled();
}) })
......
...@@ -11,10 +11,10 @@ describe('User Operation confirmation modal', () => { ...@@ -11,10 +11,10 @@ describe('User Operation confirmation modal', () => {
let wrapper; let wrapper;
let formSubmitSpy; let formSubmitSpy;
const findButton = variant => const findButton = (variant) =>
wrapper wrapper
.findAll(GlButton) .findAll(GlButton)
.filter(w => w.attributes('variant') === variant) .filter((w) => w.attributes('variant') === variant)
.at(0); .at(0);
const findForm = () => wrapper.find('form'); const findForm = () => wrapper.find('form');
const findUsernameInput = () => wrapper.find(GlFormInput); const findUsernameInput = () => wrapper.find(GlFormInput);
...@@ -25,7 +25,7 @@ describe('User Operation confirmation modal', () => { ...@@ -25,7 +25,7 @@ describe('User Operation confirmation modal', () => {
const getMethodParam = () => new FormData(findForm().element).get('_method'); const getMethodParam = () => new FormData(findForm().element).get('_method');
const getFormAction = () => findForm().attributes('action'); const getFormAction = () => findForm().attributes('action');
const setUsername = username => { const setUsername = (username) => {
findUsernameInput().vm.$emit('input', username); findUsernameInput().vm.$emit('input', username);
}; };
......
...@@ -20,7 +20,7 @@ describe('UserInternalRegexHandler', () => { ...@@ -20,7 +20,7 @@ describe('UserInternalRegexHandler', () => {
}); });
describe('Behaviour of userExternal checkbox when', () => { describe('Behaviour of userExternal checkbox when', () => {
it('matches email as internal', done => { it('matches email as internal', (done) => {
expect($warningMessage.hasClass('hidden')).toBeTruthy(); expect($warningMessage.hasClass('hidden')).toBeTruthy();
$userEmail.val('test@').trigger('input'); $userEmail.val('test@').trigger('input');
...@@ -30,7 +30,7 @@ describe('UserInternalRegexHandler', () => { ...@@ -30,7 +30,7 @@ describe('UserInternalRegexHandler', () => {
done(); done();
}); });
it('matches email as external', done => { it('matches email as external', (done) => {
expect($warningMessage.hasClass('hidden')).toBeTruthy(); expect($warningMessage.hasClass('hidden')).toBeTruthy();
$userEmail.val('test.ext@').trigger('input'); $userEmail.val('test.ext@').trigger('input');
......
...@@ -31,10 +31,10 @@ describe('Todos', () => { ...@@ -31,10 +31,10 @@ describe('Todos', () => {
}); });
describe('goToTodoUrl', () => { describe('goToTodoUrl', () => {
it('opens the todo url', done => { it('opens the todo url', (done) => {
const todoLink = todoItem.dataset.url; const todoLink = todoItem.dataset.url;
visitUrl.mockImplementation(url => { visitUrl.mockImplementation((url) => {
expect(url).toEqual(todoLink); expect(url).toEqual(todoLink);
done(); done();
}); });
...@@ -61,7 +61,7 @@ describe('Todos', () => { ...@@ -61,7 +61,7 @@ describe('Todos', () => {
}); });
it('run native funcionality when avatar is clicked', () => { it('run native funcionality when avatar is clicked', () => {
$('.todos-list a').on('click', e => e.preventDefault()); $('.todos-list a').on('click', (e) => e.preventDefault());
$('.todos-list img').trigger(metakeyEvent); $('.todos-list img').trigger(metakeyEvent);
expect(visitUrl).not.toHaveBeenCalled(); expect(visitUrl).not.toHaveBeenCalled();
...@@ -72,7 +72,7 @@ describe('Todos', () => { ...@@ -72,7 +72,7 @@ describe('Todos', () => {
describe('on done todo click', () => { describe('on done todo click', () => {
let onToggleSpy; let onToggleSpy;
beforeEach(done => { beforeEach((done) => {
const el = document.querySelector('.js-done-todo'); const el = document.querySelector('.js-done-todo');
const path = el.dataset.href; const path = el.dataset.href;
......
...@@ -15,7 +15,7 @@ describe('BitbucketServerStatusTable', () => { ...@@ -15,7 +15,7 @@ describe('BitbucketServerStatusTable', () => {
const findReconfigureButton = () => const findReconfigureButton = () =>
wrapper wrapper
.findAll(GlButton) .findAll(GlButton)
.filter(w => w.props().variant === 'info') .filter((w) => w.props().variant === 'info')
.at(0); .at(0);
afterEach(() => { afterEach(() => {
......
...@@ -50,9 +50,9 @@ describe('Promote label modal', () => { ...@@ -50,9 +50,9 @@ describe('Promote label modal', () => {
vm.$destroy(); vm.$destroy();
}); });
it('redirects when a label is promoted', done => { it('redirects when a label is promoted', (done) => {
const responseURL = `${TEST_HOST}/dummy/endpoint`; const responseURL = `${TEST_HOST}/dummy/endpoint`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(labelMockData.url); expect(url).toBe(labelMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteLabelModal.requestStarted', 'promoteLabelModal.requestStarted',
...@@ -76,10 +76,10 @@ describe('Promote label modal', () => { ...@@ -76,10 +76,10 @@ describe('Promote label modal', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays an error if promoting a label failed', done => { it('displays an error if promoting a label failed', (done) => {
const dummyError = new Error('promoting label failed'); const dummyError = new Error('promoting label failed');
dummyError.response = { status: 500 }; dummyError.response = { status: 500 };
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(labelMockData.url); expect(url).toBe(labelMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteLabelModal.requestStarted', 'promoteLabelModal.requestStarted',
...@@ -89,7 +89,7 @@ describe('Promote label modal', () => { ...@@ -89,7 +89,7 @@ describe('Promote label modal', () => {
}); });
vm.onSubmit() vm.onSubmit()
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', { expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', {
labelUrl: labelMockData.url, labelUrl: labelMockData.url,
......
...@@ -32,9 +32,9 @@ describe('delete_milestone_modal.vue', () => { ...@@ -32,9 +32,9 @@ describe('delete_milestone_modal.vue', () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
}); });
it('deletes milestone and redirects to overview page', done => { it('deletes milestone and redirects to overview page', (done) => {
const responseURL = `${TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`; const responseURL = `${TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`;
jest.spyOn(axios, 'delete').mockImplementation(url => { jest.spyOn(axios, 'delete').mockImplementation((url) => {
expect(url).toBe(props.milestoneUrl); expect(url).toBe(props.milestoneUrl);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'deleteMilestoneModal.requestStarted', 'deleteMilestoneModal.requestStarted',
...@@ -60,10 +60,10 @@ describe('delete_milestone_modal.vue', () => { ...@@ -60,10 +60,10 @@ describe('delete_milestone_modal.vue', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays error if deleting milestone failed', done => { it('displays error if deleting milestone failed', (done) => {
const dummyError = new Error('deleting milestone failed'); const dummyError = new Error('deleting milestone failed');
dummyError.response = { status: 418 }; dummyError.response = { status: 418 };
jest.spyOn(axios, 'delete').mockImplementation(url => { jest.spyOn(axios, 'delete').mockImplementation((url) => {
expect(url).toBe(props.milestoneUrl); expect(url).toBe(props.milestoneUrl);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'deleteMilestoneModal.requestStarted', 'deleteMilestoneModal.requestStarted',
...@@ -74,7 +74,7 @@ describe('delete_milestone_modal.vue', () => { ...@@ -74,7 +74,7 @@ describe('delete_milestone_modal.vue', () => {
}); });
vm.onSubmit() vm.onSubmit()
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(redirectTo).not.toHaveBeenCalled(); expect(redirectTo).not.toHaveBeenCalled();
expect(eventHub.$emit).toHaveBeenCalledWith('deleteMilestoneModal.requestFinished', { expect(eventHub.$emit).toHaveBeenCalledWith('deleteMilestoneModal.requestFinished', {
......
...@@ -46,9 +46,9 @@ describe('Promote milestone modal', () => { ...@@ -46,9 +46,9 @@ describe('Promote milestone modal', () => {
vm.$destroy(); vm.$destroy();
}); });
it('redirects when a milestone is promoted', done => { it('redirects when a milestone is promoted', (done) => {
const responseURL = `${TEST_HOST}/dummy/endpoint`; const responseURL = `${TEST_HOST}/dummy/endpoint`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(milestoneMockData.url); expect(url).toBe(milestoneMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteMilestoneModal.requestStarted', 'promoteMilestoneModal.requestStarted',
...@@ -72,10 +72,10 @@ describe('Promote milestone modal', () => { ...@@ -72,10 +72,10 @@ describe('Promote milestone modal', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('displays an error if promoting a milestone failed', done => { it('displays an error if promoting a milestone failed', (done) => {
const dummyError = new Error('promoting milestone failed'); const dummyError = new Error('promoting milestone failed');
dummyError.response = { status: 500 }; dummyError.response = { status: 500 };
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation((url) => {
expect(url).toBe(milestoneMockData.url); expect(url).toBe(milestoneMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
'promoteMilestoneModal.requestStarted', 'promoteMilestoneModal.requestStarted',
...@@ -85,7 +85,7 @@ describe('Promote milestone modal', () => { ...@@ -85,7 +85,7 @@ describe('Promote milestone modal', () => {
}); });
vm.onSubmit() vm.onSubmit()
.catch(error => { .catch((error) => {
expect(error).toBe(dummyError); expect(error).toBe(dummyError);
expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', { expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', {
milestoneUrl: milestoneMockData.url, milestoneUrl: milestoneMockData.url,
......
...@@ -46,7 +46,7 @@ describe('EmojiMenu', () => { ...@@ -46,7 +46,7 @@ describe('EmojiMenu', () => {
const dummyEmoji = 'tropical_fish'; const dummyEmoji = 'tropical_fish';
const dummyVotesBlock = () => $('<div />'); const dummyVotesBlock = () => $('<div />');
it('calls selectEmojiCallback', done => { it('calls selectEmojiCallback', (done) => {
expect(dummySelectEmojiCallback).not.toHaveBeenCalled(); expect(dummySelectEmojiCallback).not.toHaveBeenCalled();
emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => { emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => {
...@@ -55,7 +55,7 @@ describe('EmojiMenu', () => { ...@@ -55,7 +55,7 @@ describe('EmojiMenu', () => {
}); });
}); });
it('does not make an axios request', done => { it('does not make an axios request', (done) => {
jest.spyOn(axios, 'request').mockReturnValue(); jest.spyOn(axios, 'request').mockReturnValue();
emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => { emojiMenu.addAward(dummyVotesBlock(), dummyAwardUrl, dummyEmoji, false, () => {
......
...@@ -30,7 +30,7 @@ describe('Fork groups list item component', () => { ...@@ -30,7 +30,7 @@ describe('Fork groups list item component', () => {
const DUMMY_PATH = '/dummy/path'; const DUMMY_PATH = '/dummy/path';
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = shallowMount(ForkGroupsListItem, { wrapper = shallowMount(ForkGroupsListItem, {
propsData: { propsData: {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
...@@ -70,7 +70,7 @@ describe('Fork groups list item component', () => { ...@@ -70,7 +70,7 @@ describe('Fork groups list item component', () => {
expect( expect(
wrapper wrapper
.findAll(GlLink) .findAll(GlLink)
.filter(w => w.text() === DUMMY_FULL_NAME) .filter((w) => w.text() === DUMMY_FULL_NAME)
.at(0) .at(0)
.attributes().href, .attributes().href,
).toBe(DUMMY_PATH); ).toBe(DUMMY_PATH);
......
...@@ -21,7 +21,7 @@ describe('Fork groups list component', () => { ...@@ -21,7 +21,7 @@ describe('Fork groups list component', () => {
const replyWith = (...args) => axiosMock.onGet(DEFAULT_PROPS.endpoint).reply(...args); const replyWith = (...args) => axiosMock.onGet(DEFAULT_PROPS.endpoint).reply(...args);
const createWrapper = propsData => { const createWrapper = (propsData) => {
wrapper = shallowMount(ForkGroupsList, { wrapper = shallowMount(ForkGroupsList, {
propsData: { propsData: {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
......
...@@ -26,7 +26,7 @@ describe('Interval Pattern Input Component', () => { ...@@ -26,7 +26,7 @@ describe('Interval Pattern Input Component', () => {
const findCustomInput = () => wrapper.find('#schedule_cron'); const findCustomInput = () => wrapper.find('#schedule_cron');
const findAllLabels = () => wrapper.findAll('label'); const findAllLabels = () => wrapper.findAll('label');
const findSelectedRadio = () => const findSelectedRadio = () =>
wrapper.findAll('input[type="radio"]').wrappers.find(x => x.element.checked); wrapper.findAll('input[type="radio"]').wrappers.find((x) => x.element.checked);
const findSelectedRadioKey = () => findSelectedRadio()?.attributes('data-testid'); const findSelectedRadioKey = () => findSelectedRadio()?.attributes('data-testid');
const selectEveryDayRadio = () => findEveryDayRadio().trigger('click'); const selectEveryDayRadio = () => findEveryDayRadio().trigger('click');
const selectEveryWeekRadio = () => findEveryWeekRadio().trigger('click'); const selectEveryWeekRadio = () => findEveryWeekRadio().trigger('click');
...@@ -129,7 +129,7 @@ describe('Interval Pattern Input Component', () => { ...@@ -129,7 +129,7 @@ describe('Interval Pattern Input Component', () => {
}); });
it('renders each label for radio options properly', () => { it('renders each label for radio options properly', () => {
const labels = findAllLabels().wrappers.map(el => trimText(el.text())); const labels = findAllLabels().wrappers.map((el) => trimText(el.text()));
expect(labels).toEqual([ expect(labels).toEqual([
'Every day (at 4:00am)', 'Every day (at 4:00am)',
......
...@@ -47,7 +47,7 @@ describe('Timezone Dropdown', () => { ...@@ -47,7 +47,7 @@ describe('Timezone Dropdown', () => {
const data = $dropdownEl.data('data'); const data = $dropdownEl.data('data');
const formatted = $wrapper.find(tzListSel).text(); const formatted = $wrapper.find(tzListSel).text();
data.forEach(item => { data.forEach((item) => {
expect(formatted).toContain(formatTimezone(item)); expect(formatted).toContain(formatTimezone(item));
}); });
}); });
...@@ -100,7 +100,7 @@ describe('Timezone Dropdown', () => { ...@@ -100,7 +100,7 @@ describe('Timezone Dropdown', () => {
new TimezoneDropdown({ new TimezoneDropdown({
$inputEl, $inputEl,
$dropdownEl, $dropdownEl,
displayFormat: selectedItem => formatTimezone(selectedItem), displayFormat: (selectedItem) => formatTimezone(selectedItem),
}); });
expect($wrapper.find(tzDropdownToggleText).html()).toEqual('[UTC - 2.5] Newfoundland'); expect($wrapper.find(tzDropdownToggleText).html()).toEqual('[UTC - 2.5] Newfoundland');
......
...@@ -19,7 +19,7 @@ describe('Project Feature Settings', () => { ...@@ -19,7 +19,7 @@ describe('Project Feature Settings', () => {
}; };
let wrapper; let wrapper;
const mountComponent = customProps => { const mountComponent = (customProps) => {
const propsData = { ...defaultProps, ...customProps }; const propsData = { ...defaultProps, ...customProps };
return shallowMount(projectFeatureSetting, { propsData }); return shallowMount(projectFeatureSetting, { propsData });
}; };
......
...@@ -367,7 +367,7 @@ describe('Settings Panel', () => { ...@@ -367,7 +367,7 @@ describe('Settings Panel', () => {
const repositoryFeatureToggleButton = findRepositoryFeatureSetting().find('button'); const repositoryFeatureToggleButton = findRepositoryFeatureSetting().find('button');
const lfsFeatureToggleButton = findLFSFeatureToggle().find('button'); const lfsFeatureToggleButton = findLFSFeatureToggle().find('button');
const isToggleButtonChecked = toggleButton => toggleButton.classes('is-checked'); const isToggleButtonChecked = (toggleButton) => toggleButton.classes('is-checked');
// assert the initial state // assert the initial state
expect(isToggleButtonChecked(lfsFeatureToggleButton)).toBe(true); expect(isToggleButtonChecked(lfsFeatureToggleButton)).toBe(true);
......
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