Commit 85af3689 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 17 files - 73 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 325fb305
...@@ -2255,22 +2255,3 @@ spec/frontend/set_status_modal/set_status_modal_wrapper_spec.js ...@@ -2255,22 +2255,3 @@ spec/frontend/set_status_modal/set_status_modal_wrapper_spec.js
spec/frontend/shared/popover_spec.js spec/frontend/shared/popover_spec.js
spec/frontend/shortcuts_spec.js spec/frontend/shortcuts_spec.js
spec/frontend/sidebar/assignee_title_spec.js spec/frontend/sidebar/assignee_title_spec.js
## upbeat-elion
spec/frontend/vuex_shared/modules/modal/actions_spec.js
spec/frontend/whats_new/components/app_spec.js
spec/frontend/wikis_spec.js
spec/frontend_integration/ide/ide_integration_spec.js
spec/frontend_integration/test_helpers/fixtures.js
spec/frontend_integration/test_helpers/mock_server/index.js
spec/frontend_integration/test_helpers/mock_server/routes/404.js
spec/frontend_integration/test_helpers/mock_server/routes/ci.js
spec/frontend_integration/test_helpers/mock_server/routes/graphql.js
spec/frontend_integration/test_helpers/mock_server/routes/index.js
spec/frontend_integration/test_helpers/mock_server/routes/projects.js
spec/frontend_integration/test_helpers/mock_server/routes/repository.js
spec/frontend_integration/test_helpers/snapshot_serializer.js
spec/javascripts/fly_out_nav_browser_spec.js
spec/javascripts/lib/utils/browser_spec.js
spec/javascripts/matchers.js
spec/javascripts/test_bundle.js
...@@ -4,7 +4,7 @@ import * as actions from '~/vuex_shared/modules/modal/actions'; ...@@ -4,7 +4,7 @@ import * as actions from '~/vuex_shared/modules/modal/actions';
describe('Vuex ModalModule actions', () => { describe('Vuex ModalModule actions', () => {
describe('open', () => { describe('open', () => {
it('works', done => { it('works', (done) => {
const data = { id: 7 }; const data = { id: 7 };
testAction(actions.open, data, {}, [{ type: types.OPEN, payload: data }], [], done); testAction(actions.open, data, {}, [{ type: types.OPEN, payload: data }], [], done);
...@@ -12,19 +12,19 @@ describe('Vuex ModalModule actions', () => { ...@@ -12,19 +12,19 @@ describe('Vuex ModalModule actions', () => {
}); });
describe('close', () => { describe('close', () => {
it('works', done => { it('works', (done) => {
testAction(actions.close, null, {}, [{ type: types.CLOSE }], [], done); testAction(actions.close, null, {}, [{ type: types.CLOSE }], [], done);
}); });
}); });
describe('show', () => { describe('show', () => {
it('works', done => { it('works', (done) => {
testAction(actions.show, null, {}, [{ type: types.SHOW }], [], done); testAction(actions.show, null, {}, [{ type: types.SHOW }], [], done);
}); });
}); });
describe('hide', () => { describe('hide', () => {
it('works', done => { it('works', (done) => {
testAction(actions.hide, null, {}, [{ type: types.HIDE }], [], done); testAction(actions.hide, null, {}, [{ type: types.HIDE }], [], done);
}); });
}); });
......
...@@ -103,7 +103,7 @@ describe('App', () => { ...@@ -103,7 +103,7 @@ describe('App', () => {
expect(actions.closeDrawer).toHaveBeenCalled(); expect(actions.closeDrawer).toHaveBeenCalled();
}); });
it.each([true, false])('passes open property', async openState => { it.each([true, false])('passes open property', async (openState) => {
wrapper.vm.$store.state.open = openState; wrapper.vm.$store.state.open = openState;
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -183,7 +183,7 @@ describe('App', () => { ...@@ -183,7 +183,7 @@ describe('App', () => {
const clickSecondTab = async () => { const clickSecondTab = async () => {
const secondTab = wrapper.findAll('.nav-link').at(1); const secondTab = wrapper.findAll('.nav-link').at(1);
await secondTab.trigger('click'); await secondTab.trigger('click');
await new Promise(resolve => requestAnimationFrame(resolve)); await new Promise((resolve) => requestAnimationFrame(resolve));
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -5,7 +5,7 @@ import { setHTMLFixture } from './helpers/fixtures'; ...@@ -5,7 +5,7 @@ import { setHTMLFixture } from './helpers/fixtures';
describe('Wikis', () => { describe('Wikis', () => {
describe('setting the commit message when the title changes', () => { describe('setting the commit message when the title changes', () => {
const editFormHtmlFixture = args => `<form class="wiki-form ${ const editFormHtmlFixture = (args) => `<form class="wiki-form ${
args.newPage ? 'js-new-wiki-page' : '' args.newPage ? 'js-new-wiki-page' : ''
}"> }">
<input type="text" id="wiki_title" value="My title" /> <input type="text" id="wiki_title" value="My title" />
......
...@@ -66,7 +66,7 @@ describe('WebIDE', () => { ...@@ -66,7 +66,7 @@ describe('WebIDE', () => {
// Assert that +test is the only open tab // Assert that +test is the only open tab
const tabs = Array.from(document.querySelectorAll('.multi-file-tab')); const tabs = Array.from(document.querySelectorAll('.multi-file-tab'));
expect(tabs.map(x => x.textContent.trim())).toEqual(['+test']); expect(tabs.map((x) => x.textContent.trim())).toEqual(['+test']);
}); });
describe('editor info', () => { describe('editor info', () => {
......
...@@ -10,9 +10,9 @@ const createFactoryWithDefault = (fn, defaultValue) => () => { ...@@ -10,9 +10,9 @@ const createFactoryWithDefault = (fn, defaultValue) => () => {
}; };
const factory = { const factory = {
json: fn => createFactoryWithDefault(fn, { error: 'fixture not found' }), json: (fn) => createFactoryWithDefault(fn, { error: 'fixture not found' }),
text: fn => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'), text: (fn) => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'),
binary: fn => createFactoryWithDefault(fn, ''), binary: (fn) => createFactoryWithDefault(fn, ''),
}; };
export const getProject = factory.json(() => require('test_fixtures/api/projects/get.json')); export const getProject = factory.json(() => require('test_fixtures/api/projects/get.json'));
......
...@@ -26,7 +26,7 @@ export const createMockServerOptions = () => ({ ...@@ -26,7 +26,7 @@ export const createMockServerOptions = () => ({
}, },
seeds(schema) { seeds(schema) {
schema.db.loadData({ schema.db.loadData({
files: getRepositoryFiles().map(path => ({ path })), files: getRepositoryFiles().map((path) => ({ path })),
projects: [getProject(), getEmptyProject()], projects: [getProject(), getEmptyProject()],
branches: [getBranch()], branches: [getBranch()],
mergeRequests: getMergeRequests(), mergeRequests: getMergeRequests(),
......
export default server => { export default (server) => {
['get', 'post', 'put', 'delete', 'patch'].forEach(method => { ['get', 'post', 'put', 'delete', 'patch'].forEach((method) => {
server[method]('*', () => { server[method]('*', () => {
return new Response(404); return new Response(404);
}); });
......
import { getPipelinesEmptyResponse } from 'test_helpers/fixtures'; import { getPipelinesEmptyResponse } from 'test_helpers/fixtures';
export default server => { export default (server) => {
server.get('*/commit/:id/pipelines', () => { server.get('*/commit/:id/pipelines', () => {
return getPipelinesEmptyResponse(); return getPipelinesEmptyResponse();
}); });
......
import { graphqlQuery } from '../graphql'; import { graphqlQuery } from '../graphql';
export default server => { export default (server) => {
server.post('/api/graphql', (schema, request) => { server.post('/api/graphql', (schema, request) => {
const batches = JSON.parse(request.requestBody); const batches = JSON.parse(request.requestBody);
......
/* eslint-disable global-require */ /* eslint-disable global-require */
export default server => { export default (server) => {
[ [
require('./graphql'), require('./graphql'),
require('./projects'), require('./projects'),
......
import { withKeys } from 'test_helpers/utils/obj'; import { withKeys } from 'test_helpers/utils/obj';
export default server => { export default (server) => {
server.get('/api/v4/projects/:id', (schema, request) => { server.get('/api/v4/projects/:id', (schema, request) => {
const { id } = request.params; const { id } = request.params;
......
import { createNewCommit, createCommitIdGenerator } from 'test_helpers/factories'; import { createNewCommit, createCommitIdGenerator } from 'test_helpers/factories';
export default server => { export default (server) => {
const commitIdGenerator = createCommitIdGenerator(); const commitIdGenerator = createCommitIdGenerator();
server.get('/api/v4/projects/:id/repository/branches', schema => { server.get('/api/v4/projects/:id/repository/branches', (schema) => {
return schema.db.branches; return schema.db.branches;
}); });
...@@ -15,7 +15,7 @@ export default server => { ...@@ -15,7 +15,7 @@ export default server => {
return branch.attrs; return branch.attrs;
}); });
server.get('*/-/files/:id', schema => { server.get('*/-/files/:id', (schema) => {
return schema.db.files.map(({ path }) => path); return schema.db.files.map(({ path }) => path);
}); });
......
...@@ -4,7 +4,7 @@ export default { ...@@ -4,7 +4,7 @@ export default {
}, },
print(element, serialize) { print(element, serialize) {
element.$_hit = true; element.$_hit = true;
element.querySelectorAll('[style]').forEach(el => { element.querySelectorAll('[style]').forEach((el) => {
el.$_hit = true; el.$_hit = true;
if (el.style.display === 'none') { if (el.style.display === 'none') {
el.textContent = '(jest: contents hidden)'; el.textContent = '(jest: contents hidden)';
......
...@@ -157,7 +157,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -157,7 +157,7 @@ describe('Fly out sidebar navigation', () => {
'<div class="sidebar-sub-level-items" style="position: absolute; top: 0; left: 100px; height: 200px;"></div>'; '<div class="sidebar-sub-level-items" style="position: absolute; top: 0; left: 100px; height: 200px;"></div>';
}); });
it('shows sub-items after 0ms if no menu is open', done => { it('shows sub-items after 0ms if no menu is open', (done) => {
mouseEnterTopItems(el); mouseEnterTopItems(el);
expect(getHideSubItemsInterval()).toBe(0); expect(getHideSubItemsInterval()).toBe(0);
...@@ -169,7 +169,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -169,7 +169,7 @@ describe('Fly out sidebar navigation', () => {
}); });
}); });
it('shows sub-items after 300ms if a menu is currently open', done => { it('shows sub-items after 300ms if a menu is currently open', (done) => {
documentMouseMove({ documentMouseMove({
clientX: el.getBoundingClientRect().left, clientX: el.getBoundingClientRect().left,
clientY: el.getBoundingClientRect().top, clientY: el.getBoundingClientRect().top,
......
...@@ -21,8 +21,8 @@ const PIXEL_TOLERANCE = 0.2; ...@@ -21,8 +21,8 @@ const PIXEL_TOLERANCE = 0.2;
* @param url * @param url
* @returns {Promise} * @returns {Promise}
*/ */
const urlToImage = url => const urlToImage = (url) =>
new Promise(resolve => { new Promise((resolve) => {
const img = new Image(); const img = new Image();
img.onload = function () { img.onload = function () {
resolve(img); resolve(img);
...@@ -64,10 +64,10 @@ describe('common_utils browser specific specs', () => { ...@@ -64,10 +64,10 @@ describe('common_utils browser specific specs', () => {
}); });
describe('createOverlayIcon', () => { describe('createOverlayIcon', () => {
it('should return the favicon with the overlay', done => { it('should return the favicon with the overlay', (done) => {
commonUtils commonUtils
.createOverlayIcon(faviconDataUrl, overlayDataUrl) .createOverlayIcon(faviconDataUrl, overlayDataUrl)
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) .then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => { .then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE); expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done(); done();
...@@ -88,11 +88,11 @@ describe('common_utils browser specific specs', () => { ...@@ -88,11 +88,11 @@ describe('common_utils browser specific specs', () => {
document.body.removeChild(document.getElementById('favicon')); document.body.removeChild(document.getElementById('favicon'));
}); });
it('should set page favicon to provided favicon overlay', done => { it('should set page favicon to provided favicon overlay', (done) => {
commonUtils commonUtils
.setFaviconOverlay(overlayDataUrl) .setFaviconOverlay(overlayDataUrl)
.then(() => document.getElementById('favicon').getAttribute('href')) .then(() => document.getElementById('favicon').getAttribute('href'))
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) .then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => { .then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE); expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done(); done();
...@@ -119,7 +119,7 @@ describe('common_utils browser specific specs', () => { ...@@ -119,7 +119,7 @@ describe('common_utils browser specific specs', () => {
document.body.removeChild(document.getElementById('favicon')); document.body.removeChild(document.getElementById('favicon'));
}); });
it('should reset favicon in case of error', done => { it('should reset favicon in case of error', (done) => {
mock.onGet(BUILD_URL).replyOnce(500); mock.onGet(BUILD_URL).replyOnce(500);
commonUtils.setCiStatusFavicon(BUILD_URL).catch(() => { commonUtils.setCiStatusFavicon(BUILD_URL).catch(() => {
...@@ -130,7 +130,7 @@ describe('common_utils browser specific specs', () => { ...@@ -130,7 +130,7 @@ describe('common_utils browser specific specs', () => {
}); });
}); });
it('should set page favicon to CI status favicon based on provided status', done => { it('should set page favicon to CI status favicon based on provided status', (done) => {
mock.onGet(BUILD_URL).reply(200, { mock.onGet(BUILD_URL).reply(200, {
favicon: overlayDataUrl, favicon: overlayDataUrl,
}); });
...@@ -138,7 +138,7 @@ describe('common_utils browser specific specs', () => { ...@@ -138,7 +138,7 @@ describe('common_utils browser specific specs', () => {
commonUtils commonUtils
.setCiStatusFavicon(BUILD_URL) .setCiStatusFavicon(BUILD_URL)
.then(() => document.getElementById('favicon').getAttribute('href')) .then(() => document.getElementById('favicon').getAttribute('href'))
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)])) .then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => { .then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE); expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done(); done();
......
...@@ -2,7 +2,7 @@ import pixelmatch from 'pixelmatch'; ...@@ -2,7 +2,7 @@ import pixelmatch from 'pixelmatch';
export default { export default {
toImageDiffEqual: () => { toImageDiffEqual: () => {
const getImageData = img => { const getImageData = (img) => {
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');
canvas.width = img.width; canvas.width = img.width;
canvas.height = img.height; canvas.height = img.height;
......
...@@ -30,7 +30,7 @@ Vue.config.warnHandler = (msg, vm, trace) => { ...@@ -30,7 +30,7 @@ Vue.config.warnHandler = (msg, vm, trace) => {
const currentStack = new Error().stack; const currentStack = new Error().stack;
const isInVueTestUtils = currentStack const isInVueTestUtils = currentStack
.split('\n') .split('\n')
.some(line => line.startsWith(' at VueWrapper.setProps (')); .some((line) => line.startsWith(' at VueWrapper.setProps ('));
if (isInVueTestUtils) { if (isInVueTestUtils) {
return; return;
} }
...@@ -75,7 +75,7 @@ gon.relative_url_root = ''; ...@@ -75,7 +75,7 @@ gon.relative_url_root = '';
let hasUnhandledPromiseRejections = false; let hasUnhandledPromiseRejections = false;
window.addEventListener('unhandledrejection', event => { window.addEventListener('unhandledrejection', (event) => {
hasUnhandledPromiseRejections = true; hasUnhandledPromiseRejections = true;
console.error('Unhandled promise rejection:'); console.error('Unhandled promise rejection:');
console.error(event.reason.stack || event.reason); console.error(event.reason.stack || event.reason);
...@@ -87,11 +87,11 @@ window.addEventListener('unhandledrejection', event => { ...@@ -87,11 +87,11 @@ window.addEventListener('unhandledrejection', event => {
// enough for the socket to continue to communicate. // enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes // The downside is that it creates a minor performance penalty in the time it takes
// to run our unit tests. // to run our unit tests.
beforeEach(done => done()); beforeEach((done) => done());
let longRunningTestTimeoutHandle; let longRunningTestTimeoutHandle;
beforeEach(done => { beforeEach((done) => {
longRunningTestTimeoutHandle = setTimeout(() => { longRunningTestTimeoutHandle = setTimeout(() => {
done.fail('Test is running too long!'); done.fail('Test is running too long!');
}, 4000); }, 4000);
...@@ -111,8 +111,8 @@ if (process.env.IS_EE) { ...@@ -111,8 +111,8 @@ if (process.env.IS_EE) {
testContexts.push(require.context('ee_spec', true, /_spec$/)); testContexts.push(require.context('ee_spec', true, /_spec$/));
} }
testContexts.forEach(context => { testContexts.forEach((context) => {
context.keys().forEach(path => { context.keys().forEach((path) => {
try { try {
context(path); context(path);
} catch (err) { } catch (err) {
...@@ -128,7 +128,7 @@ testContexts.forEach(context => { ...@@ -128,7 +128,7 @@ testContexts.forEach(context => {
}); });
describe('test errors', () => { describe('test errors', () => {
beforeAll(done => { beforeAll((done) => {
if (hasUnhandledPromiseRejections || hasVueWarnings || hasVueErrors) { if (hasUnhandledPromiseRejections || hasVueWarnings || hasVueErrors) {
setTimeout(done, 1000); setTimeout(done, 1000);
} else { } else {
......
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