Commit 7cfe360c authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 54 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -1706,41 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js ...@@ -1706,41 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js spec/frontend/behaviors/secret_values_spec.js
## eager-lamport
spec/frontend/behaviors/shortcuts/keybindings_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
spec/frontend/blob/components/blob_content_error_spec.js
spec/frontend/blob/components/blob_edit_content_spec.js
spec/frontend/blob/components/blob_edit_header_spec.js
spec/frontend/blob/components/blob_header_spec.js
spec/frontend/blob/sketch/index_spec.js
spec/frontend/blob/utils_spec.js
spec/frontend/blob/viewer/index_spec.js
spec/frontend/blob_edit/edit_blob_spec.js
spec/frontend/boards/board_list_new_spec.js
spec/frontend/boards/board_list_spec.js
spec/frontend/boards/boards_store_spec.js
spec/frontend/boards/components/board_assignee_dropdown_spec.js
spec/frontend/boards/components/board_card_layout_spec.js
spec/frontend/boards/components/board_card_spec.js
spec/frontend/boards/components/board_configuration_options_spec.js
spec/frontend/boards/components/board_list_header_new_spec.js
spec/frontend/boards/components/board_list_header_spec.js
spec/frontend/boards/components/boards_selector_spec.js
spec/frontend/boards/components/issue_count_spec.js
spec/frontend/boards/components/issue_due_date_spec.js
spec/frontend/boards/components/issue_time_estimate_deprecated_spec.js
spec/frontend/boards/components/issue_time_estimate_spec.js
spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js
spec/frontend/boards/components/sidebar/remove_issue_spec.js
spec/frontend/boards/issue_card_deprecated_spec.js
spec/frontend/boards/issue_card_inner_spec.js
spec/frontend/boards/list_spec.js
spec/frontend/boards/mock_data.js
spec/frontend/boards/stores/actions_spec.js
spec/frontend/boards/stores/getters_spec.js
spec/frontend/boards/stores/mutations_spec.js
## busy-mayer ## busy-mayer
spec/frontend/branches/branches_delete_modal_spec.js spec/frontend/branches/branches_delete_modal_spec.js
spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js spec/frontend/ci_settings_pipeline_triggers/components/triggers_list_spec.js
......
...@@ -9,7 +9,7 @@ describe('~/behaviors/shortcuts/keybindings.js', () => { ...@@ -9,7 +9,7 @@ describe('~/behaviors/shortcuts/keybindings.js', () => {
useLocalStorageSpy(); useLocalStorageSpy();
}); });
const setupCustomizations = async customizationsAsString => { const setupCustomizations = async (customizationsAsString) => {
localStorage.clear(); localStorage.clear();
if (customizationsAsString) { if (customizationsAsString) {
......
...@@ -15,7 +15,7 @@ describe('ShortcutsIssuable', () => { ...@@ -15,7 +15,7 @@ describe('ShortcutsIssuable', () => {
preloadFixtures(snippetShowFixtureName, mrShowFixtureName); preloadFixtures(snippetShowFixtureName, mrShowFixtureName);
beforeAll(done => { beforeAll((done) => {
initCopyAsGFM(); initCopyAsGFM();
// Fake call to nodeToGfm so the import of lazy bundle happened // Fake call to nodeToGfm so the import of lazy bundle happened
...@@ -81,7 +81,7 @@ describe('ShortcutsIssuable', () => { ...@@ -81,7 +81,7 @@ describe('ShortcutsIssuable', () => {
stubSelection('<p>Selected text.</p>'); stubSelection('<p>Selected text.</p>');
}); });
it('leaves existing input intact', done => { it('leaves existing input intact', (done) => {
$(FORM_SELECTOR).val('This text was already here.'); $(FORM_SELECTOR).val('This text was already here.');
expect($(FORM_SELECTOR).val()).toBe('This text was already here.'); expect($(FORM_SELECTOR).val()).toBe('This text was already here.');
...@@ -96,7 +96,7 @@ describe('ShortcutsIssuable', () => { ...@@ -96,7 +96,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `input`', done => { it('triggers `input`', (done) => {
let triggered = false; let triggered = false;
$(FORM_SELECTOR).on('input', () => { $(FORM_SELECTOR).on('input', () => {
triggered = true; triggered = true;
...@@ -110,7 +110,7 @@ describe('ShortcutsIssuable', () => { ...@@ -110,7 +110,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `focus`', done => { it('triggers `focus`', (done) => {
const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -122,7 +122,7 @@ describe('ShortcutsIssuable', () => { ...@@ -122,7 +122,7 @@ describe('ShortcutsIssuable', () => {
}); });
describe('with a one-line selection', () => { describe('with a one-line selection', () => {
it('quotes the selection', done => { it('quotes the selection', (done) => {
stubSelection('<p>This text has been selected.</p>'); stubSelection('<p>This text has been selected.</p>');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -134,7 +134,7 @@ describe('ShortcutsIssuable', () => { ...@@ -134,7 +134,7 @@ describe('ShortcutsIssuable', () => {
}); });
describe('with a multi-line selection', () => { describe('with a multi-line selection', () => {
it('quotes the selected lines as a group', done => { it('quotes the selected lines as a group', (done) => {
stubSelection( stubSelection(
'<p>Selected line one.</p>\n<p>Selected line two.</p>\n<p>Selected line three.</p>', '<p>Selected line one.</p>\n<p>Selected line two.</p>\n<p>Selected line three.</p>',
); );
...@@ -154,7 +154,7 @@ describe('ShortcutsIssuable', () => { ...@@ -154,7 +154,7 @@ describe('ShortcutsIssuable', () => {
stubSelection('<p>Selected text.</p>', true); stubSelection('<p>Selected text.</p>', true);
}); });
it('does not add anything to the input', done => { it('does not add anything to the input', (done) => {
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
setImmediate(() => { setImmediate(() => {
...@@ -163,7 +163,7 @@ describe('ShortcutsIssuable', () => { ...@@ -163,7 +163,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `focus`', done => { it('triggers `focus`', (done) => {
const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -179,7 +179,7 @@ describe('ShortcutsIssuable', () => { ...@@ -179,7 +179,7 @@ describe('ShortcutsIssuable', () => {
stubSelection('<div class="md">Selected text.</div><p>Invalid selected text.</p>', true); stubSelection('<div class="md">Selected text.</div><p>Invalid selected text.</p>', true);
}); });
it('only adds the valid part to the input', done => { it('only adds the valid part to the input', (done) => {
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
setImmediate(() => { setImmediate(() => {
...@@ -188,7 +188,7 @@ describe('ShortcutsIssuable', () => { ...@@ -188,7 +188,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `focus`', done => { it('triggers `focus`', (done) => {
const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -198,7 +198,7 @@ describe('ShortcutsIssuable', () => { ...@@ -198,7 +198,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `input`', done => { it('triggers `input`', (done) => {
let triggered = false; let triggered = false;
$(FORM_SELECTOR).on('input', () => { $(FORM_SELECTOR).on('input', () => {
triggered = true; triggered = true;
...@@ -233,7 +233,7 @@ describe('ShortcutsIssuable', () => { ...@@ -233,7 +233,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('adds the quoted selection to the input', done => { it('adds the quoted selection to the input', (done) => {
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
setImmediate(() => { setImmediate(() => {
...@@ -242,7 +242,7 @@ describe('ShortcutsIssuable', () => { ...@@ -242,7 +242,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `focus`', done => { it('triggers `focus`', (done) => {
const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -252,7 +252,7 @@ describe('ShortcutsIssuable', () => { ...@@ -252,7 +252,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `input`', done => { it('triggers `input`', (done) => {
let triggered = false; let triggered = false;
$(FORM_SELECTOR).on('input', () => { $(FORM_SELECTOR).on('input', () => {
triggered = true; triggered = true;
...@@ -287,7 +287,7 @@ describe('ShortcutsIssuable', () => { ...@@ -287,7 +287,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('does not add anything to the input', done => { it('does not add anything to the input', (done) => {
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
setImmediate(() => { setImmediate(() => {
...@@ -296,7 +296,7 @@ describe('ShortcutsIssuable', () => { ...@@ -296,7 +296,7 @@ describe('ShortcutsIssuable', () => {
}); });
}); });
it('triggers `focus`', done => { it('triggers `focus`', (done) => {
const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus'); const spy = jest.spyOn(document.querySelector(FORM_SELECTOR), 'focus');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -308,7 +308,7 @@ describe('ShortcutsIssuable', () => { ...@@ -308,7 +308,7 @@ describe('ShortcutsIssuable', () => {
}); });
describe('with a valid selection with no text content', () => { describe('with a valid selection with no text content', () => {
it('returns the proper markdown', done => { it('returns the proper markdown', (done) => {
stubSelection('<img src="https://gitlab.com/logo.png" alt="logo" />'); stubSelection('<img src="https://gitlab.com/logo.png" alt="logo" />');
ShortcutsIssuable.replyWithSelectedText(true); ShortcutsIssuable.replyWithSelectedText(true);
...@@ -334,7 +334,7 @@ describe('ShortcutsIssuable', () => { ...@@ -334,7 +334,7 @@ describe('ShortcutsIssuable', () => {
'.sidebar-source-branch button', '.sidebar-source-branch button',
); );
[sidebarCollapsedBtn, sidebarExpandedBtn].forEach(btn => jest.spyOn(btn, 'click')); [sidebarCollapsedBtn, sidebarExpandedBtn].forEach((btn) => jest.spyOn(btn, 'click'));
}); });
afterEach(() => { afterEach(() => {
......
...@@ -32,7 +32,7 @@ describe('Blob Content Error component', () => { ...@@ -32,7 +32,7 @@ describe('Blob Content Error component', () => {
viewerError: error.id, viewerError: error.id,
}); });
expect(wrapper.text()).toContain(reason); expect(wrapper.text()).toContain(reason);
options.forEach(option => { options.forEach((option) => {
expect(wrapper.text()).toContain(option); expect(wrapper.text()).toContain(option);
}); });
}); });
...@@ -52,7 +52,7 @@ describe('Blob Content Error component', () => { ...@@ -52,7 +52,7 @@ describe('Blob Content Error component', () => {
}, },
}); });
expect(wrapper.text()).toContain(reason); expect(wrapper.text()).toContain(reason);
options.forEach(option => { options.forEach((option) => {
expect(wrapper.text()).toContain(option); expect(wrapper.text()).toContain(option);
}); });
}); });
......
...@@ -40,7 +40,7 @@ describe('Blob Header Editing', () => { ...@@ -40,7 +40,7 @@ describe('Blob Header Editing', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const triggerChangeContent = val => { const triggerChangeContent = (val) => {
getValue.mockReturnValue(val); getValue.mockReturnValue(val);
const [cb] = onDidChangeModelContent.mock.calls[0]; const [cb] = onDidChangeModelContent.mock.calls[0];
......
...@@ -15,7 +15,7 @@ describe('Blob Header Editing', () => { ...@@ -15,7 +15,7 @@ describe('Blob Header Editing', () => {
}); });
}; };
const findDeleteButton = () => const findDeleteButton = () =>
wrapper.findAll(GlButton).wrappers.find(x => x.text() === 'Delete file'); wrapper.findAll(GlButton).wrappers.find((x) => x.text() === 'Delete file');
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
......
...@@ -75,7 +75,7 @@ describe('Blob Header Default Actions', () => { ...@@ -75,7 +75,7 @@ describe('Blob Header Default Actions', () => {
expect(wrapper.find(DefaultActions).exists()).toBe(false); expect(wrapper.find(DefaultActions).exists()).toBe(false);
}); });
Object.keys(slots).forEach(slot => { Object.keys(slots).forEach((slot) => {
it('renders the slots', () => { it('renders the slots', () => {
const slotContent = slots[slot]; const slotContent = slots[slot];
createComponent( createComponent(
......
...@@ -11,7 +11,7 @@ describe('Sketch viewer', () => { ...@@ -11,7 +11,7 @@ describe('Sketch viewer', () => {
}); });
describe('with error message', () => { describe('with error message', () => {
beforeEach(done => { beforeEach((done) => {
jest.spyOn(SketchLoader.prototype, 'getZipFile').mockImplementation( jest.spyOn(SketchLoader.prototype, 'getZipFile').mockImplementation(
() => () =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
...@@ -37,7 +37,7 @@ describe('Sketch viewer', () => { ...@@ -37,7 +37,7 @@ describe('Sketch viewer', () => {
}); });
describe('success', () => { describe('success', () => {
beforeEach(done => { beforeEach((done) => {
const loadAsyncMock = { const loadAsyncMock = {
files: { files: {
'previews/preview.png': { 'previews/preview.png': {
...@@ -48,7 +48,7 @@ describe('Sketch viewer', () => { ...@@ -48,7 +48,7 @@ describe('Sketch viewer', () => {
loadAsyncMock.files['previews/preview.png'].async.mockImplementation( loadAsyncMock.files['previews/preview.png'].async.mockImplementation(
() => () =>
new Promise(resolve => { new Promise((resolve) => {
resolve('foo'); resolve('foo');
done(); done();
}), }),
......
...@@ -26,7 +26,7 @@ describe('Blob utilities', () => { ...@@ -26,7 +26,7 @@ describe('Blob utilities', () => {
it.each([[{}], [{ blobPath, blobContent, blobGlobalId }]])( it.each([[{}], [{ blobPath, blobContent, blobGlobalId }]])(
'creates the instance with the passed parameters %s', 'creates the instance with the passed parameters %s',
extraParams => { (extraParams) => {
const params = { const params = {
el: editorEl, el: editorEl,
...extraParams, ...extraParams,
......
...@@ -37,7 +37,7 @@ describe('Blob viewer', () => { ...@@ -37,7 +37,7 @@ describe('Blob viewer', () => {
window.location.hash = ''; window.location.hash = '';
}); });
it('loads source file after switching views', done => { it('loads source file after switching views', (done) => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setImmediate(() => { setImmediate(() => {
...@@ -51,7 +51,7 @@ describe('Blob viewer', () => { ...@@ -51,7 +51,7 @@ describe('Blob viewer', () => {
}); });
}); });
it('loads source file when line number is in hash', done => { it('loads source file when line number is in hash', (done) => {
window.location.hash = '#L1'; window.location.hash = '#L1';
new BlobViewer(); new BlobViewer();
...@@ -117,7 +117,7 @@ describe('Blob viewer', () => { ...@@ -117,7 +117,7 @@ describe('Blob viewer', () => {
expect(copyButton.blur).not.toHaveBeenCalled(); expect(copyButton.blur).not.toHaveBeenCalled();
}); });
it('enables after switching to simple view', done => { it('enables after switching to simple view', (done) => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setImmediate(() => { setImmediate(() => {
...@@ -127,7 +127,7 @@ describe('Blob viewer', () => { ...@@ -127,7 +127,7 @@ describe('Blob viewer', () => {
}); });
}); });
it('updates tooltip after switching to simple view', done => { it('updates tooltip after switching to simple view', (done) => {
document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click();
setImmediate(() => { setImmediate(() => {
...@@ -171,7 +171,7 @@ describe('Blob viewer', () => { ...@@ -171,7 +171,7 @@ describe('Blob viewer', () => {
${['simple', 'rich']} ${['simple', 'rich']}
`('when view switches to $views', ({ views }) => { `('when view switches to $views', ({ views }) => {
beforeEach(async () => { beforeEach(async () => {
views.forEach(view => blob.switchToViewer(view)); views.forEach((view) => blob.switchToViewer(view));
await axios.waitForAll(); await axios.waitForAll();
}); });
......
...@@ -31,7 +31,7 @@ describe('Blob Editing', () => { ...@@ -31,7 +31,7 @@ describe('Blob Editing', () => {
FileTemplateExtension.mockClear(); FileTemplateExtension.mockClear();
}); });
const editorInst = isMarkdown => { const editorInst = (isMarkdown) => {
return new EditBlob({ return new EditBlob({
isMarkdown, isMarkdown,
}); });
......
...@@ -82,7 +82,7 @@ const createComponent = ({ ...@@ -82,7 +82,7 @@ const createComponent = ({
describe('Board list component', () => { describe('Board list component', () => {
let wrapper; let wrapper;
const findByTestId = testId => wrapper.find(`[data-testid="${testId}"]`); const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`);
useFakeRequestAnimationFrame(); useFakeRequestAnimationFrame();
afterEach(() => { afterEach(() => {
......
...@@ -72,7 +72,7 @@ describe('Board list component', () => { ...@@ -72,7 +72,7 @@ describe('Board list component', () => {
} }
describe('When Expanded', () => { describe('When Expanded', () => {
beforeEach(done => { beforeEach((done) => {
getIssues = jest.spyOn(List.prototype, 'getIssues').mockReturnValue(new Promise(() => {})); getIssues = jest.spyOn(List.prototype, 'getIssues').mockReturnValue(new Promise(() => {}));
({ mock, component } = createComponent({ done })); ({ mock, component } = createComponent({ done }));
}); });
...@@ -204,7 +204,7 @@ describe('Board list component', () => { ...@@ -204,7 +204,7 @@ describe('Board list component', () => {
}); });
describe('When Collapsed', () => { describe('When Collapsed', () => {
beforeEach(done => { beforeEach((done) => {
getIssues = jest.spyOn(List.prototype, 'getIssues').mockReturnValue(new Promise(() => {})); getIssues = jest.spyOn(List.prototype, 'getIssues').mockReturnValue(new Promise(() => {}));
({ mock, component } = createComponent({ ({ mock, component } = createComponent({
done, done,
...@@ -228,7 +228,7 @@ describe('Board list component', () => { ...@@ -228,7 +228,7 @@ describe('Board list component', () => {
}); });
describe('max issue count warning', () => { describe('max issue count warning', () => {
beforeEach(done => { beforeEach((done) => {
({ mock, component } = createComponent({ ({ mock, component } = createComponent({
done, done,
listProps: { type: 'closed', collapsed: true, issuesSize: 50 }, listProps: { type: 'closed', collapsed: true, issuesSize: 50 },
......
...@@ -77,7 +77,7 @@ describe('boardsStore', () => { ...@@ -77,7 +77,7 @@ describe('boardsStore', () => {
beforeEach(() => { beforeEach(() => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock.onPost(endpoints.listsEndpoint).replyOnce(config => requestSpy(config)); axiosMock.onPost(endpoints.listsEndpoint).replyOnce((config) => requestSpy(config));
}); });
it('makes a request to create a list', () => { it('makes a request to create a list', () => {
...@@ -114,7 +114,7 @@ describe('boardsStore', () => { ...@@ -114,7 +114,7 @@ describe('boardsStore', () => {
beforeEach(() => { beforeEach(() => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock.onPut(`${endpoints.listsEndpoint}/${id}`).replyOnce(config => requestSpy(config)); axiosMock.onPut(`${endpoints.listsEndpoint}/${id}`).replyOnce((config) => requestSpy(config));
}); });
it('makes a request to update a list position', () => { it('makes a request to update a list position', () => {
...@@ -148,7 +148,7 @@ describe('boardsStore', () => { ...@@ -148,7 +148,7 @@ describe('boardsStore', () => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock axiosMock
.onDelete(`${endpoints.listsEndpoint}/${id}`) .onDelete(`${endpoints.listsEndpoint}/${id}`)
.replyOnce(config => requestSpy(config)); .replyOnce((config) => requestSpy(config));
}); });
it('makes a request to delete a list', () => { it('makes a request to delete a list', () => {
...@@ -269,7 +269,7 @@ describe('boardsStore', () => { ...@@ -269,7 +269,7 @@ describe('boardsStore', () => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock axiosMock
.onPut(`${urlRoot}/-/boards/${boardId}/issues/${id}`) .onPut(`${urlRoot}/-/boards/${boardId}/issues/${id}`)
.replyOnce(config => requestSpy(config)); .replyOnce((config) => requestSpy(config));
}); });
it('makes a request to move an issue between lists', () => { it('makes a request to move an issue between lists', () => {
...@@ -308,7 +308,7 @@ describe('boardsStore', () => { ...@@ -308,7 +308,7 @@ describe('boardsStore', () => {
beforeEach(() => { beforeEach(() => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock.onPost(url).replyOnce(config => requestSpy(config)); axiosMock.onPost(url).replyOnce((config) => requestSpy(config));
}); });
it('makes a request to create a new issue', () => { it('makes a request to create a new issue', () => {
...@@ -378,7 +378,7 @@ describe('boardsStore', () => { ...@@ -378,7 +378,7 @@ describe('boardsStore', () => {
beforeEach(() => { beforeEach(() => {
requestSpy = jest.fn(); requestSpy = jest.fn();
axiosMock.onPost(endpoints.bulkUpdatePath).replyOnce(config => requestSpy(config)); axiosMock.onPost(endpoints.bulkUpdatePath).replyOnce((config) => requestSpy(config));
}); });
it('makes a request to create a list', () => { it('makes a request to create a list', () => {
......
...@@ -93,8 +93,8 @@ describe('BoardCardAssigneeDropdown', () => { ...@@ -93,8 +93,8 @@ describe('BoardCardAssigneeDropdown', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}; };
const findByText = text => { const findByText = (text) => {
return wrapper.findAll(GlDropdownItem).wrappers.find(node => node.text().indexOf(text) === 0); return wrapper.findAll(GlDropdownItem).wrappers.find((node) => node.text().indexOf(text) === 0);
}; };
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
......
...@@ -22,7 +22,7 @@ describe('Board card layout', () => { ...@@ -22,7 +22,7 @@ describe('Board card layout', () => {
let list; let list;
// this particular mount component needs to be used after the root beforeEach because it depends on list being initialized // this particular mount component needs to be used after the root beforeEach because it depends on list being initialized
const mountComponent = propsData => { const mountComponent = (propsData) => {
wrapper = shallowMount(BoardCardLayout, { wrapper = shallowMount(BoardCardLayout, {
stubs: { stubs: {
issueCardInner, issueCardInner,
......
...@@ -29,7 +29,7 @@ describe('BoardCard', () => { ...@@ -29,7 +29,7 @@ describe('BoardCard', () => {
const findUserAvatarLink = () => wrapper.find(userAvatarLink); const findUserAvatarLink = () => wrapper.find(userAvatarLink);
// this particular mount component needs to be used after the root beforeEach because it depends on list being initialized // this particular mount component needs to be used after the root beforeEach because it depends on list being initialized
const mountComponent = propsData => { const mountComponent = (propsData) => {
wrapper = mount(BoardCard, { wrapper = mount(BoardCard, {
stubs: { stubs: {
issueCardInner, issueCardInner,
......
...@@ -80,13 +80,13 @@ describe('Board List Header Component', () => { ...@@ -80,13 +80,13 @@ describe('Board List Header Component', () => {
const hasNoAddButton = [ListType.closed]; const hasNoAddButton = [ListType.closed];
const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee]; const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee];
it.each(hasNoAddButton)('does not render when List Type is `%s`', listType => { it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findAddIssueButton().exists()).toBe(false); expect(findAddIssueButton().exists()).toBe(false);
}); });
it.each(hasAddButton)('does render when List Type is `%s`', listType => { it.each(hasAddButton)('does render when List Type is `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findAddIssueButton().exists()).toBe(true); expect(findAddIssueButton().exists()).toBe(true);
...@@ -95,7 +95,7 @@ describe('Board List Header Component', () => { ...@@ -95,7 +95,7 @@ describe('Board List Header Component', () => {
it('has a test for each list type', () => { it('has a test for each list type', () => {
createComponent(); createComponent();
Object.values(ListType).forEach(value => { Object.values(ListType).forEach((value) => {
expect([...hasAddButton, ...hasNoAddButton]).toContain(value); expect([...hasAddButton, ...hasNoAddButton]).toContain(value);
}); });
}); });
...@@ -171,14 +171,14 @@ describe('Board List Header Component', () => { ...@@ -171,14 +171,14 @@ describe('Board List Header Component', () => {
it.each(cannotDragList)( it.each(cannotDragList)(
'does not have user-can-drag-class so user cannot drag list', 'does not have user-can-drag-class so user cannot drag list',
listType => { (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findTitle().classes()).not.toContain('user-can-drag'); expect(findTitle().classes()).not.toContain('user-can-drag');
}, },
); );
it.each(canDragList)('has user-can-drag-class so user can drag list', listType => { it.each(canDragList)('has user-can-drag-class so user can drag list', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findTitle().classes()).toContain('user-can-drag'); expect(findTitle().classes()).toContain('user-can-drag');
......
...@@ -76,20 +76,20 @@ describe('Board List Header Component', () => { ...@@ -76,20 +76,20 @@ describe('Board List Header Component', () => {
const hasNoAddButton = [ListType.closed]; const hasNoAddButton = [ListType.closed];
const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee]; const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee];
it.each(hasNoAddButton)('does not render when List Type is `%s`', listType => { it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findAddIssueButton().exists()).toBe(false); expect(findAddIssueButton().exists()).toBe(false);
}); });
it.each(hasAddButton)('does render when List Type is `%s`', listType => { it.each(hasAddButton)('does render when List Type is `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
expect(findAddIssueButton().exists()).toBe(true); expect(findAddIssueButton().exists()).toBe(true);
}); });
it('has a test for each list type', () => { it('has a test for each list type', () => {
Object.values(ListType).forEach(value => { Object.values(ListType).forEach((value) => {
expect([...hasAddButton, ...hasNoAddButton]).toContain(value); expect([...hasAddButton, ...hasNoAddButton]).toContain(value);
}); });
}); });
......
...@@ -26,7 +26,7 @@ describe('BoardsSelector', () => { ...@@ -26,7 +26,7 @@ describe('BoardsSelector', () => {
const boards = boardGenerator(20); const boards = boardGenerator(20);
const recentBoards = boardGenerator(5); const recentBoards = boardGenerator(5);
const fillSearchBox = filterTerm => { const fillSearchBox = (filterTerm) => {
const searchBox = wrapper.find({ ref: 'searchBox' }); const searchBox = wrapper.find({ ref: 'searchBox' });
const searchBoxInput = searchBox.find('input'); const searchBoxInput = searchBox.find('input');
searchBoxInput.setValue(filterTerm); searchBoxInput.setValue(filterTerm);
...@@ -59,7 +59,7 @@ describe('BoardsSelector', () => { ...@@ -59,7 +59,7 @@ describe('BoardsSelector', () => {
data: { data: {
group: { group: {
boards: { boards: {
edges: boards.map(board => ({ node: board })), edges: boards.map((board) => ({ node: board })),
}, },
}, },
}, },
...@@ -152,7 +152,7 @@ describe('BoardsSelector', () => { ...@@ -152,7 +152,7 @@ describe('BoardsSelector', () => {
it('shows only matching boards when filtering', () => { it('shows only matching boards when filtering', () => {
const filterTerm = 'board1'; const filterTerm = 'board1';
const expectedCount = boards.filter(board => board.name.includes(filterTerm)).length; const expectedCount = boards.filter((board) => board.name.includes(filterTerm)).length;
fillSearchBox(filterTerm); fillSearchBox(filterTerm);
......
...@@ -6,7 +6,7 @@ describe('IssueCount', () => { ...@@ -6,7 +6,7 @@ describe('IssueCount', () => {
let maxIssueCount; let maxIssueCount;
let issuesSize; let issuesSize;
const createComponent = props => { const createComponent = (props) => {
vm = shallowMount(IssueCount, { propsData: props }); vm = shallowMount(IssueCount, { propsData: props });
}; };
......
...@@ -10,7 +10,7 @@ const createComponent = (dueDate = new Date(), closed = false) => ...@@ -10,7 +10,7 @@ const createComponent = (dueDate = new Date(), closed = false) =>
}, },
}); });
const findTime = wrapper => wrapper.find('time'); const findTime = (wrapper) => wrapper.find('time');
describe('Issue Due Date component', () => { describe('Issue Due Date component', () => {
let wrapper; let wrapper;
......
...@@ -31,7 +31,7 @@ describe('Issue Time Estimate component', () => { ...@@ -31,7 +31,7 @@ describe('Issue Time Estimate component', () => {
expect(wrapper.find('.js-issue-time-estimate').text()).toContain('2 weeks 3 days 1 minute'); expect(wrapper.find('.js-issue-time-estimate').text()).toContain('2 weeks 3 days 1 minute');
}); });
it('prevents tooltip xss', done => { it('prevents tooltip xss', (done) => {
const alertSpy = jest.spyOn(window, 'alert'); const alertSpy = jest.spyOn(window, 'alert');
wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -28,7 +28,7 @@ describe('Issue Time Estimate component', () => { ...@@ -28,7 +28,7 @@ describe('Issue Time Estimate component', () => {
expect(wrapper.find('.js-issue-time-estimate').text()).toContain('2 weeks 3 days 1 minute'); expect(wrapper.find('.js-issue-time-estimate').text()).toContain('2 weeks 3 days 1 minute');
}); });
it('prevents tooltip xss', done => { it('prevents tooltip xss', (done) => {
const alertSpy = jest.spyOn(window, 'alert'); const alertSpy = jest.spyOn(window, 'alert');
wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' }); wrapper.setProps({ estimate: 'Foo <script>alert("XSS")</script>' });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
......
...@@ -83,7 +83,7 @@ describe('~/boards/components/sidebar/board_sidebar_subscription_spec.vue', () = ...@@ -83,7 +83,7 @@ describe('~/boards/components/sidebar/board_sidebar_subscription_spec.vue', () =
}); });
describe('Board sidebar subscription component `behavior`', () => { describe('Board sidebar subscription component `behavior`', () => {
const mockSetActiveIssueSubscribed = subscribedState => { const mockSetActiveIssueSubscribed = (subscribedState) => {
jest.spyOn(wrapper.vm, 'setActiveIssueSubscribed').mockImplementation(async () => { jest.spyOn(wrapper.vm, 'setActiveIssueSubscribed').mockImplementation(async () => {
store.commit(types.UPDATE_ISSUE_BY_ID, { store.commit(types.UPDATE_ISSUE_BY_ID, {
issueId: mockActiveIssue.id, issueId: mockActiveIssue.id,
......
...@@ -8,7 +8,7 @@ describe('boards sidebar remove issue', () => { ...@@ -8,7 +8,7 @@ describe('boards sidebar remove issue', () => {
const findButton = () => wrapper.find(GlButton); const findButton = () => wrapper.find(GlButton);
const createComponent = propsData => { const createComponent = (propsData) => {
wrapper = shallowMount(RemoveIssue, { wrapper = shallowMount(RemoveIssue, {
propsData: { propsData: {
issue: {}, issue: {},
......
...@@ -79,7 +79,7 @@ describe('Issue card component', () => { ...@@ -79,7 +79,7 @@ describe('Issue card component', () => {
expect(wrapper.find('.issue-blocked-icon').exists()).toBe(false); expect(wrapper.find('.issue-blocked-icon').exists()).toBe(false);
}); });
it('renders confidential icon', done => { it('renders confidential icon', (done) => {
wrapper.setProps({ wrapper.setProps({
issue: { issue: {
...wrapper.props('issue'), ...wrapper.props('issue'),
...@@ -102,7 +102,7 @@ describe('Issue card component', () => { ...@@ -102,7 +102,7 @@ describe('Issue card component', () => {
}); });
describe('exists', () => { describe('exists', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.setProps({ wrapper.setProps({
issue: { issue: {
...wrapper.props('issue'), ...wrapper.props('issue'),
...@@ -132,7 +132,7 @@ describe('Issue card component', () => { ...@@ -132,7 +132,7 @@ describe('Issue card component', () => {
expect(wrapper.find('.board-card-assignee img').exists()).toBe(true); expect(wrapper.find('.board-card-assignee img').exists()).toBe(true);
}); });
it('renders the avatar using avatar_url property', done => { it('renders the avatar using avatar_url property', (done) => {
wrapper.props('issue').updateData({ wrapper.props('issue').updateData({
...wrapper.props('issue'), ...wrapper.props('issue'),
assignees: [ assignees: [
...@@ -156,7 +156,7 @@ describe('Issue card component', () => { ...@@ -156,7 +156,7 @@ describe('Issue card component', () => {
}); });
describe('assignee default avatar', () => { describe('assignee default avatar', () => {
beforeEach(done => { beforeEach((done) => {
global.gon.default_avatar_url = 'default_avatar'; global.gon.default_avatar_url = 'default_avatar';
wrapper.setProps({ wrapper.setProps({
...@@ -189,7 +189,7 @@ describe('Issue card component', () => { ...@@ -189,7 +189,7 @@ describe('Issue card component', () => {
}); });
describe('multiple assignees', () => { describe('multiple assignees', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.setProps({ wrapper.setProps({
issue: { issue: {
...wrapper.props('issue'), ...wrapper.props('issue'),
...@@ -224,7 +224,7 @@ describe('Issue card component', () => { ...@@ -224,7 +224,7 @@ describe('Issue card component', () => {
}); });
describe('more than three assignees', () => { describe('more than three assignees', () => {
beforeEach(done => { beforeEach((done) => {
const { assignees } = wrapper.props('issue'); const { assignees } = wrapper.props('issue');
assignees.push( assignees.push(
new ListAssignee({ new ListAssignee({
...@@ -252,11 +252,11 @@ describe('Issue card component', () => { ...@@ -252,11 +252,11 @@ describe('Issue card component', () => {
expect(wrapper.findAll('.board-card-assignee .avatar').length).toEqual(2); expect(wrapper.findAll('.board-card-assignee .avatar').length).toEqual(2);
}); });
it('renders 99+ avatar counter', done => { it('renders 99+ avatar counter', (done) => {
const assignees = [ const assignees = [
...wrapper.props('issue').assignees, ...wrapper.props('issue').assignees,
...range(5, 103).map( ...range(5, 103).map(
i => (i) =>
new ListAssignee({ new ListAssignee({
id: i, id: i,
name: 'name', name: 'name',
...@@ -281,7 +281,7 @@ describe('Issue card component', () => { ...@@ -281,7 +281,7 @@ describe('Issue card component', () => {
}); });
describe('labels', () => { describe('labels', () => {
beforeEach(done => { beforeEach((done) => {
issue.addLabel(label1); issue.addLabel(label1);
wrapper.setProps({ issue: { ...issue } }); wrapper.setProps({ issue: { ...issue } });
...@@ -296,7 +296,7 @@ describe('Issue card component', () => { ...@@ -296,7 +296,7 @@ describe('Issue card component', () => {
expect(label.props('backgroundColor')).toEqual(label1.color); expect(label.props('backgroundColor')).toEqual(label1.color);
}); });
it('does not render label if label does not have an ID', done => { it('does not render label if label does not have an ID', (done) => {
issue.addLabel( issue.addLabel(
new ListLabel({ new ListLabel({
title: 'closed', title: 'closed',
...@@ -315,7 +315,7 @@ describe('Issue card component', () => { ...@@ -315,7 +315,7 @@ describe('Issue card component', () => {
}); });
describe('blocked', () => { describe('blocked', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.setProps({ wrapper.setProps({
issue: { issue: {
...wrapper.props('issue'), ...wrapper.props('issue'),
......
...@@ -260,7 +260,7 @@ describe('Issue card component', () => { ...@@ -260,7 +260,7 @@ describe('Issue card component', () => {
it('renders 99+ avatar counter', async () => { it('renders 99+ avatar counter', async () => {
const assignees = [ const assignees = [
...wrapper.props('issue').assignees, ...wrapper.props('issue').assignees,
...range(5, 103).map(i => ({ ...range(5, 103).map((i) => ({
id: i, id: i,
name: 'name', name: 'name',
username: 'username', username: 'username',
......
...@@ -37,7 +37,7 @@ describe('List model', () => { ...@@ -37,7 +37,7 @@ describe('List model', () => {
describe('list type', () => { describe('list type', () => {
const notExpandableList = ['blank']; const notExpandableList = ['blank'];
const table = Object.keys(ListType).map(k => { const table = Object.keys(ListType).map((k) => {
const value = ListType[k]; const value = ListType[k];
return [value, !notExpandableList.includes(value)]; return [value, !notExpandableList.includes(value)];
}); });
...@@ -186,7 +186,7 @@ describe('List model', () => { ...@@ -186,7 +186,7 @@ describe('List model', () => {
list.issues = []; list.issues = [];
}); });
it('adds new issue to top of list', done => { it('adds new issue to top of list', (done) => {
const user = new ListAssignee({ const user = new ListAssignee({
id: 1, id: 1,
name: 'testing 123', name: 'testing 123',
......
...@@ -263,7 +263,7 @@ export const BoardsMockData = { ...@@ -263,7 +263,7 @@ export const BoardsMockData = {
}, },
}; };
export const boardsMockInterceptor = config => { export const boardsMockInterceptor = (config) => {
const body = BoardsMockData[config.method.toUpperCase()][config.url]; const body = BoardsMockData[config.method.toUpperCase()][config.url];
return [200, body]; return [200, body];
}; };
...@@ -318,7 +318,7 @@ export const mockLists = [mockList, mockLabelList]; ...@@ -318,7 +318,7 @@ export const mockLists = [mockList, mockLabelList];
export const mockListsById = keyBy(mockLists, 'id'); export const mockListsById = keyBy(mockLists, 'id');
export const mockListsWithModel = mockLists.map(listMock => export const mockListsWithModel = mockLists.map((listMock) =>
Vue.observable(new List({ ...listMock, doNotFetchIssues: true })), Vue.observable(new List({ ...listMock, doNotFetchIssues: true })),
); );
......
...@@ -21,7 +21,7 @@ import createFlash from '~/flash'; ...@@ -21,7 +21,7 @@ import createFlash from '~/flash';
jest.mock('~/flash'); jest.mock('~/flash');
const expectNotImplemented = action => { const expectNotImplemented = (action) => {
it('is not implemented', () => { it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!')); expect(action).toThrow(new Error('Not implemented!'));
}); });
...@@ -29,7 +29,7 @@ const expectNotImplemented = action => { ...@@ -29,7 +29,7 @@ const expectNotImplemented = action => {
// We need this helper to make sure projectPath is including // We need this helper to make sure projectPath is including
// subgroups when the movIssue action is called. // subgroups when the movIssue action is called.
const getProjectPath = path => path.split('#')[0]; const getProjectPath = (path) => path.split('#')[0];
beforeEach(() => { beforeEach(() => {
window.gon = { features: {} }; window.gon = { features: {} };
...@@ -53,7 +53,7 @@ describe('setInitialBoardData', () => { ...@@ -53,7 +53,7 @@ describe('setInitialBoardData', () => {
}); });
describe('setFilters', () => { describe('setFilters', () => {
it('should commit mutation SET_FILTERS', done => { it('should commit mutation SET_FILTERS', (done) => {
const state = { const state = {
filters: {}, filters: {},
}; };
...@@ -72,11 +72,11 @@ describe('setFilters', () => { ...@@ -72,11 +72,11 @@ describe('setFilters', () => {
}); });
describe('performSearch', () => { describe('performSearch', () => {
it('should dispatch setFilters action', done => { it('should dispatch setFilters action', (done) => {
testAction(actions.performSearch, {}, {}, [], [{ type: 'setFilters', payload: {} }], done); testAction(actions.performSearch, {}, {}, [], [{ type: 'setFilters', payload: {} }], done);
}); });
it('should dispatch setFilters, fetchLists and resetIssues action when graphqlBoardLists FF is on', done => { it('should dispatch setFilters, fetchLists and resetIssues action when graphqlBoardLists FF is on', (done) => {
window.gon = { features: { graphqlBoardLists: true } }; window.gon = { features: { graphqlBoardLists: true } };
testAction( testAction(
actions.performSearch, actions.performSearch,
...@@ -90,7 +90,7 @@ describe('performSearch', () => { ...@@ -90,7 +90,7 @@ describe('performSearch', () => {
}); });
describe('setActiveId', () => { describe('setActiveId', () => {
it('should commit mutation SET_ACTIVE_ID', done => { it('should commit mutation SET_ACTIVE_ID', (done) => {
const state = { const state = {
activeId: inactiveId, activeId: inactiveId,
}; };
...@@ -129,7 +129,7 @@ describe('fetchLists', () => { ...@@ -129,7 +129,7 @@ describe('fetchLists', () => {
const formattedLists = formatBoardLists(queryResponse.data.group.board.lists); const formattedLists = formatBoardLists(queryResponse.data.group.board.lists);
it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', done => { it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction( testAction(
...@@ -147,7 +147,7 @@ describe('fetchLists', () => { ...@@ -147,7 +147,7 @@ describe('fetchLists', () => {
); );
}); });
it('dispatch createList action when backlog list does not exist and is not hidden', done => { it('dispatch createList action when backlog list does not exist and is not hidden', (done) => {
queryResponse = { queryResponse = {
data: { data: {
group: { group: {
...@@ -179,7 +179,7 @@ describe('fetchLists', () => { ...@@ -179,7 +179,7 @@ describe('fetchLists', () => {
}); });
describe('createList', () => { describe('createList', () => {
it('should dispatch addList action when creating backlog list', done => { it('should dispatch addList action when creating backlog list', (done) => {
const backlogList = { const backlogList = {
id: 'gid://gitlab/List/1', id: 'gid://gitlab/List/1',
listType: 'backlog', listType: 'backlog',
...@@ -216,7 +216,7 @@ describe('createList', () => { ...@@ -216,7 +216,7 @@ describe('createList', () => {
); );
}); });
it('should commit CREATE_LIST_FAILURE mutation when API returns an error', done => { it('should commit CREATE_LIST_FAILURE mutation when API returns an error', (done) => {
jest.spyOn(gqlClient, 'mutate').mockReturnValue( jest.spyOn(gqlClient, 'mutate').mockReturnValue(
Promise.resolve({ Promise.resolve({
data: { data: {
...@@ -248,7 +248,7 @@ describe('createList', () => { ...@@ -248,7 +248,7 @@ describe('createList', () => {
}); });
describe('moveList', () => { describe('moveList', () => {
it('should commit MOVE_LIST mutation and dispatch updateList action', done => { it('should commit MOVE_LIST mutation and dispatch updateList action', (done) => {
const initialBoardListsState = { const initialBoardListsState = {
'gid://gitlab/List/1': mockLists[0], 'gid://gitlab/List/1': mockLists[0],
'gid://gitlab/List/2': mockLists[1], 'gid://gitlab/List/2': mockLists[1],
...@@ -321,7 +321,7 @@ describe('moveList', () => { ...@@ -321,7 +321,7 @@ describe('moveList', () => {
}); });
describe('updateList', () => { describe('updateList', () => {
it('should commit UPDATE_LIST_FAILURE mutation when API returns an error', done => { it('should commit UPDATE_LIST_FAILURE mutation when API returns an error', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
updateBoardList: { updateBoardList: {
...@@ -438,7 +438,7 @@ describe('fetchIssuesForList', () => { ...@@ -438,7 +438,7 @@ describe('fetchIssuesForList', () => {
boardType: 'group', boardType: 'group',
}; };
const mockIssuesNodes = mockIssues.map(issue => ({ node: issue })); const mockIssuesNodes = mockIssues.map((issue) => ({ node: issue }));
const pageInfo = { const pageInfo = {
endCursor: '', endCursor: '',
...@@ -471,7 +471,7 @@ describe('fetchIssuesForList', () => { ...@@ -471,7 +471,7 @@ describe('fetchIssuesForList', () => {
[listId]: pageInfo, [listId]: pageInfo,
}; };
it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', done => { it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_SUCCESS on success', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
testAction( testAction(
...@@ -493,7 +493,7 @@ describe('fetchIssuesForList', () => { ...@@ -493,7 +493,7 @@ describe('fetchIssuesForList', () => {
); );
}); });
it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', done => { it('should commit mutations REQUEST_ISSUES_FOR_LIST and RECEIVE_ISSUES_FOR_LIST_FAILURE on failure', (done) => {
jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject()); jest.spyOn(gqlClient, 'query').mockResolvedValue(Promise.reject());
testAction( testAction(
...@@ -540,7 +540,7 @@ describe('moveIssue', () => { ...@@ -540,7 +540,7 @@ describe('moveIssue', () => {
issues, issues,
}; };
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', done => { it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_SUCCESS mutation when successful', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
issueMoveList: { issueMoveList: {
...@@ -615,7 +615,7 @@ describe('moveIssue', () => { ...@@ -615,7 +615,7 @@ describe('moveIssue', () => {
expect(gqlClient.mutate).toHaveBeenCalledWith(mutationVariables); expect(gqlClient.mutate).toHaveBeenCalledWith(mutationVariables);
}); });
it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', done => { it('should commit MOVE_ISSUE mutation and MOVE_ISSUE_FAILURE mutation when unsuccessful', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
issueMoveList: { issueMoveList: {
...@@ -686,7 +686,7 @@ describe('setAssignees', () => { ...@@ -686,7 +686,7 @@ describe('setAssignees', () => {
}); });
}); });
it('calls the correct mutation with the correct values', done => { it('calls the correct mutation with the correct values', (done) => {
testAction( testAction(
actions.setAssignees, actions.setAssignees,
{}, {},
...@@ -743,7 +743,7 @@ describe('createNewIssue', () => { ...@@ -743,7 +743,7 @@ describe('createNewIssue', () => {
expect(result).toEqual(mockIssue); expect(result).toEqual(mockIssue);
}); });
it('should commit CREATE_ISSUE_FAILURE mutation when API returns an error', done => { it('should commit CREATE_ISSUE_FAILURE mutation when API returns an error', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
createIssue: { createIssue: {
...@@ -767,7 +767,7 @@ describe('createNewIssue', () => { ...@@ -767,7 +767,7 @@ describe('createNewIssue', () => {
}); });
describe('addListIssue', () => { describe('addListIssue', () => {
it('should commit ADD_ISSUE_TO_LIST mutation', done => { it('should commit ADD_ISSUE_TO_LIST mutation', (done) => {
const payload = { const payload = {
list: mockLists[0], list: mockLists[0],
issue: mockIssue, issue: mockIssue,
...@@ -788,14 +788,14 @@ describe('addListIssue', () => { ...@@ -788,14 +788,14 @@ describe('addListIssue', () => {
describe('setActiveIssueLabels', () => { describe('setActiveIssueLabels', () => {
const state = { issues: { [mockIssue.id]: mockIssue } }; const state = { issues: { [mockIssue.id]: mockIssue } };
const getters = { activeIssue: mockIssue }; const getters = { activeIssue: mockIssue };
const testLabelIds = labels.map(label => label.id); const testLabelIds = labels.map((label) => label.id);
const input = { const input = {
addLabelIds: testLabelIds, addLabelIds: testLabelIds,
removeLabelIds: [], removeLabelIds: [],
projectPath: 'h/b', projectPath: 'h/b',
}; };
it('should assign labels on success', done => { it('should assign labels on success', (done) => {
jest jest
.spyOn(gqlClient, 'mutate') .spyOn(gqlClient, 'mutate')
.mockResolvedValue({ data: { updateIssue: { issue: { labels: { nodes: labels } } } } }); .mockResolvedValue({ data: { updateIssue: { issue: { labels: { nodes: labels } } } } });
...@@ -839,7 +839,7 @@ describe('setActiveIssueDueDate', () => { ...@@ -839,7 +839,7 @@ describe('setActiveIssueDueDate', () => {
projectPath: 'h/b', projectPath: 'h/b',
}; };
it('should commit due date after setting the issue', done => { it('should commit due date after setting the issue', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
updateIssue: { updateIssue: {
...@@ -890,7 +890,7 @@ describe('setActiveIssueSubscribed', () => { ...@@ -890,7 +890,7 @@ describe('setActiveIssueSubscribed', () => {
projectPath: 'gitlab-org/gitlab-test', projectPath: 'gitlab-org/gitlab-test',
}; };
it('should commit subscribed status', done => { it('should commit subscribed status', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
issueSetSubscription: { issueSetSubscription: {
...@@ -944,7 +944,7 @@ describe('setActiveIssueMilestone', () => { ...@@ -944,7 +944,7 @@ describe('setActiveIssueMilestone', () => {
projectPath: 'h/b', projectPath: 'h/b',
}; };
it('should commit milestone after setting the issue', done => { it('should commit milestone after setting the issue', (done) => {
jest.spyOn(gqlClient, 'mutate').mockResolvedValue({ jest.spyOn(gqlClient, 'mutate').mockResolvedValue({
data: { data: {
updateIssue: { updateIssue: {
......
...@@ -84,7 +84,7 @@ describe('Boards - Getters', () => { ...@@ -84,7 +84,7 @@ describe('Boards - Getters', () => {
issues, issues,
}; };
it('returns issues for a given listId', () => { it('returns issues for a given listId', () => {
const getIssueById = issueId => [mockIssue, mockIssue2].find(({ id }) => id === issueId); const getIssueById = (issueId) => [mockIssue, mockIssue2].find(({ id }) => id === issueId);
expect(getters.getIssuesByList(boardsState, { getIssueById })('gid://gitlab/List/2')).toEqual( expect(getters.getIssuesByList(boardsState, { getIssueById })('gid://gitlab/List/2')).toEqual(
mockIssues, mockIssues,
......
...@@ -3,7 +3,7 @@ import * as types from '~/boards/stores/mutation_types'; ...@@ -3,7 +3,7 @@ import * as types from '~/boards/stores/mutation_types';
import defaultState from '~/boards/stores/state'; import defaultState from '~/boards/stores/state';
import { mockLists, rawIssue, mockIssue, mockIssue2 } from '../mock_data'; import { mockLists, rawIssue, mockIssue, mockIssue2 } from '../mock_data';
const expectNotImplemented = action => { const expectNotImplemented = (action) => {
it('is not implemented', () => { it('is not implemented', () => {
expect(action).toThrow(new Error('Not implemented!')); expect(action).toThrow(new Error('Not implemented!'));
}); });
......
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