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
spec/frontend/shared/popover_spec.js
spec/frontend/shortcuts_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';
describe('Vuex ModalModule actions', () => {
describe('open', () => {
it('works', done => {
it('works', (done) => {
const data = { id: 7 };
testAction(actions.open, data, {}, [{ type: types.OPEN, payload: data }], [], done);
......@@ -12,19 +12,19 @@ describe('Vuex ModalModule actions', () => {
});
describe('close', () => {
it('works', done => {
it('works', (done) => {
testAction(actions.close, null, {}, [{ type: types.CLOSE }], [], done);
});
});
describe('show', () => {
it('works', done => {
it('works', (done) => {
testAction(actions.show, null, {}, [{ type: types.SHOW }], [], done);
});
});
describe('hide', () => {
it('works', done => {
it('works', (done) => {
testAction(actions.hide, null, {}, [{ type: types.HIDE }], [], done);
});
});
......
......@@ -103,7 +103,7 @@ describe('App', () => {
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;
await wrapper.vm.$nextTick();
......@@ -183,7 +183,7 @@ describe('App', () => {
const clickSecondTab = async () => {
const secondTab = wrapper.findAll('.nav-link').at(1);
await secondTab.trigger('click');
await new Promise(resolve => requestAnimationFrame(resolve));
await new Promise((resolve) => requestAnimationFrame(resolve));
};
beforeEach(() => {
......
......@@ -5,7 +5,7 @@ import { setHTMLFixture } from './helpers/fixtures';
describe('Wikis', () => {
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' : ''
}">
<input type="text" id="wiki_title" value="My title" />
......
......@@ -66,7 +66,7 @@ describe('WebIDE', () => {
// Assert that +test is the only open 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', () => {
......
......@@ -10,9 +10,9 @@ const createFactoryWithDefault = (fn, defaultValue) => () => {
};
const factory = {
json: fn => createFactoryWithDefault(fn, { error: 'fixture not found' }),
text: fn => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'),
binary: fn => createFactoryWithDefault(fn, ''),
json: (fn) => createFactoryWithDefault(fn, { error: 'fixture not found' }),
text: (fn) => createFactoryWithDefault(fn, 'Hello world\nHow are you today?\n'),
binary: (fn) => createFactoryWithDefault(fn, ''),
};
export const getProject = factory.json(() => require('test_fixtures/api/projects/get.json'));
......
......@@ -26,7 +26,7 @@ export const createMockServerOptions = () => ({
},
seeds(schema) {
schema.db.loadData({
files: getRepositoryFiles().map(path => ({ path })),
files: getRepositoryFiles().map((path) => ({ path })),
projects: [getProject(), getEmptyProject()],
branches: [getBranch()],
mergeRequests: getMergeRequests(),
......
export default server => {
['get', 'post', 'put', 'delete', 'patch'].forEach(method => {
export default (server) => {
['get', 'post', 'put', 'delete', 'patch'].forEach((method) => {
server[method]('*', () => {
return new Response(404);
});
......
import { getPipelinesEmptyResponse } from 'test_helpers/fixtures';
export default server => {
export default (server) => {
server.get('*/commit/:id/pipelines', () => {
return getPipelinesEmptyResponse();
});
......
import { graphqlQuery } from '../graphql';
export default server => {
export default (server) => {
server.post('/api/graphql', (schema, request) => {
const batches = JSON.parse(request.requestBody);
......
/* eslint-disable global-require */
export default server => {
export default (server) => {
[
require('./graphql'),
require('./projects'),
......
import { withKeys } from 'test_helpers/utils/obj';
export default server => {
export default (server) => {
server.get('/api/v4/projects/:id', (schema, request) => {
const { id } = request.params;
......
import { createNewCommit, createCommitIdGenerator } from 'test_helpers/factories';
export default server => {
export default (server) => {
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;
});
......@@ -15,7 +15,7 @@ export default server => {
return branch.attrs;
});
server.get('*/-/files/:id', schema => {
server.get('*/-/files/:id', (schema) => {
return schema.db.files.map(({ path }) => path);
});
......
......@@ -4,7 +4,7 @@ export default {
},
print(element, serialize) {
element.$_hit = true;
element.querySelectorAll('[style]').forEach(el => {
element.querySelectorAll('[style]').forEach((el) => {
el.$_hit = true;
if (el.style.display === 'none') {
el.textContent = '(jest: contents hidden)';
......
......@@ -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>';
});
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);
expect(getHideSubItemsInterval()).toBe(0);
......@@ -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({
clientX: el.getBoundingClientRect().left,
clientY: el.getBoundingClientRect().top,
......
......@@ -21,8 +21,8 @@ const PIXEL_TOLERANCE = 0.2;
* @param url
* @returns {Promise}
*/
const urlToImage = url =>
new Promise(resolve => {
const urlToImage = (url) =>
new Promise((resolve) => {
const img = new Image();
img.onload = function () {
resolve(img);
......@@ -64,10 +64,10 @@ describe('common_utils browser specific specs', () => {
});
describe('createOverlayIcon', () => {
it('should return the favicon with the overlay', done => {
it('should return the favicon with the overlay', (done) => {
commonUtils
.createOverlayIcon(faviconDataUrl, overlayDataUrl)
.then(url => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then((url) => Promise.all([urlToImage(url), urlToImage(faviconWithOverlayDataUrl)]))
.then(([actual, expected]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done();
......@@ -88,11 +88,11 @@ describe('common_utils browser specific specs', () => {
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
.setFaviconOverlay(overlayDataUrl)
.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]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done();
......@@ -119,7 +119,7 @@ describe('common_utils browser specific specs', () => {
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);
commonUtils.setCiStatusFavicon(BUILD_URL).catch(() => {
......@@ -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, {
favicon: overlayDataUrl,
});
......@@ -138,7 +138,7 @@ describe('common_utils browser specific specs', () => {
commonUtils
.setCiStatusFavicon(BUILD_URL)
.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]) => {
expect(actual).toImageDiffEqual(expected, PIXEL_TOLERANCE);
done();
......
......@@ -2,7 +2,7 @@ import pixelmatch from 'pixelmatch';
export default {
toImageDiffEqual: () => {
const getImageData = img => {
const getImageData = (img) => {
const canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
......
......@@ -30,7 +30,7 @@ Vue.config.warnHandler = (msg, vm, trace) => {
const currentStack = new Error().stack;
const isInVueTestUtils = currentStack
.split('\n')
.some(line => line.startsWith(' at VueWrapper.setProps ('));
.some((line) => line.startsWith(' at VueWrapper.setProps ('));
if (isInVueTestUtils) {
return;
}
......@@ -75,7 +75,7 @@ gon.relative_url_root = '';
let hasUnhandledPromiseRejections = false;
window.addEventListener('unhandledrejection', event => {
window.addEventListener('unhandledrejection', (event) => {
hasUnhandledPromiseRejections = true;
console.error('Unhandled promise rejection:');
console.error(event.reason.stack || event.reason);
......@@ -87,11 +87,11 @@ window.addEventListener('unhandledrejection', event => {
// enough for the socket to continue to communicate.
// The downside is that it creates a minor performance penalty in the time it takes
// to run our unit tests.
beforeEach(done => done());
beforeEach((done) => done());
let longRunningTestTimeoutHandle;
beforeEach(done => {
beforeEach((done) => {
longRunningTestTimeoutHandle = setTimeout(() => {
done.fail('Test is running too long!');
}, 4000);
......@@ -111,8 +111,8 @@ if (process.env.IS_EE) {
testContexts.push(require.context('ee_spec', true, /_spec$/));
}
testContexts.forEach(context => {
context.keys().forEach(path => {
testContexts.forEach((context) => {
context.keys().forEach((path) => {
try {
context(path);
} catch (err) {
......@@ -128,7 +128,7 @@ testContexts.forEach(context => {
});
describe('test errors', () => {
beforeAll(done => {
beforeAll((done) => {
if (hasUnhandledPromiseRejections || hasVueWarnings || hasVueErrors) {
setTimeout(done, 1000);
} 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