Commit 280a79c0 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 60 of 73

Part of our prettier migration; changing the arrow-parens style.
parent e94556e9
......@@ -1887,39 +1887,6 @@ spec/frontend/helpers/vuex_action_helper_spec.js
spec/frontend/helpers/wait_for_promises.js
spec/frontend/helpers/wait_using_real_timer.js
## jovial-mirzakhani
spec/frontend/ide/components/repo_commit_section_spec.js
spec/frontend/ide/components/repo_editor_spec.js
spec/frontend/ide/components/repo_tabs_spec.js
spec/frontend/ide/components/resizable_panel_spec.js
spec/frontend/ide/components/shared/tokened_input_spec.js
spec/frontend/ide/components/terminal/session_spec.js
spec/frontend/ide/components/terminal/terminal_controls_spec.js
spec/frontend/ide/components/terminal/terminal_spec.js
spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js
spec/frontend/ide/file_helpers.js
spec/frontend/ide/helpers.js
spec/frontend/ide/ide_router_extension_spec.js
spec/frontend/ide/ide_router_spec.js
spec/frontend/ide/lib/common/model_spec.js
spec/frontend/ide/lib/create_diff_spec.js
spec/frontend/ide/lib/create_file_diff_spec.js
spec/frontend/ide/lib/diff/controller_spec.js
spec/frontend/ide/lib/editor_spec.js
spec/frontend/ide/lib/editorconfig/parser_spec.js
spec/frontend/ide/lib/errors_spec.js
spec/frontend/ide/lib/files_spec.js
spec/frontend/ide/lib/mirror_spec.js
spec/frontend/ide/services/index_spec.js
spec/frontend/ide/stores/actions/file_spec.js
spec/frontend/ide/stores/actions/merge_request_spec.js
spec/frontend/ide/stores/actions/project_spec.js
spec/frontend/ide/stores/actions/tree_spec.js
spec/frontend/ide/stores/actions_spec.js
spec/frontend/ide/stores/extend_spec.js
spec/frontend/ide/stores/getters_spec.js
spec/frontend/ide/stores/integration_spec.js
## angry-bhabha
spec/frontend/ide/stores/modules/branches/actions_spec.js
spec/frontend/ide/stores/modules/branches/mutations_spec.js
......
......@@ -32,7 +32,7 @@ describe('RepoCommitSection', () => {
},
};
const files = [file('file1'), file('file2')].map(f =>
const files = [file('file1'), file('file2')].map((f) =>
Object.assign(f, {
type: 'blob',
content: 'orginal content',
......@@ -42,7 +42,7 @@ describe('RepoCommitSection', () => {
store.state.currentBranch = 'master';
store.state.changedFiles = [];
store.state.stagedFiles = [{ ...files[0] }, { ...files[1] }];
store.state.stagedFiles.forEach(f =>
store.state.stagedFiles.forEach((f) =>
Object.assign(f, {
changed: true,
staged: true,
......@@ -50,7 +50,7 @@ describe('RepoCommitSection', () => {
}),
);
files.forEach(f => {
files.forEach((f) => {
store.state.entries[f.path] = f;
});
}
......@@ -105,9 +105,9 @@ describe('RepoCommitSection', () => {
const allFiles = store.state.changedFiles.concat(store.state.stagedFiles);
const changedFileNames = wrapper
.findAll('.multi-file-commit-list > li')
.wrappers.map(x => x.text().trim());
.wrappers.map((x) => x.text().trim());
expect(changedFileNames).toEqual(allFiles.map(x => x.path));
expect(changedFileNames).toEqual(allFiles.map((x) => x.path));
});
it('does not show empty state', () => {
......@@ -141,7 +141,7 @@ describe('RepoCommitSection', () => {
beforeEach(() => {
setupDefaultState();
store.state.changedFiles = store.state.stagedFiles.map(x =>
store.state.changedFiles = store.state.stagedFiles.map((x) =>
Object.assign(x, { staged: false }),
);
store.state.stagedFiles = [];
......
......@@ -25,7 +25,7 @@ describe('RepoEditor', () => {
let store;
const waitForEditorSetup = () =>
new Promise(resolve => {
new Promise((resolve) => {
vm.$once('editorSetup', resolve);
});
......@@ -43,7 +43,7 @@ describe('RepoEditor', () => {
vm.$mount();
};
const createOpenFile = path => {
const createOpenFile = (path) => {
const origFile = store.state.openFiles[0];
const newFile = { ...origFile, path, key: path, name: 'myfile.txt', content: 'hello world' };
......@@ -91,7 +91,7 @@ describe('RepoEditor', () => {
});
const findEditor = () => vm.$el.querySelector('.multi-file-editor-holder');
const changeViewMode = viewMode =>
const changeViewMode = (viewMode) =>
store.dispatch('editor/updateFileEditor', { path: vm.file.path, data: { viewMode } });
describe('default', () => {
......@@ -119,7 +119,7 @@ describe('RepoEditor', () => {
expect(findEditor()).not.toHaveCss({ display: 'none' });
});
it('renders only an edit tab', done => {
it('renders only an edit tab', (done) => {
Vue.nextTick(() => {
const tabs = vm.$el.querySelectorAll('.ide-mode-tabs .nav-links li');
......@@ -157,7 +157,7 @@ describe('RepoEditor', () => {
mock.restore();
});
it('renders an Edit and a Preview Tab', done => {
it('renders an Edit and a Preview Tab', (done) => {
Vue.nextTick(() => {
const tabs = vm.$el.querySelectorAll('.ide-mode-tabs .nav-links li');
......@@ -169,7 +169,7 @@ describe('RepoEditor', () => {
});
});
it('renders markdown for tempFile', done => {
it('renders markdown for tempFile', (done) => {
vm.file.tempFile = true;
vm.$nextTick()
......@@ -202,7 +202,7 @@ describe('RepoEditor', () => {
});
describe('when open file is binary and not raw', () => {
beforeEach(done => {
beforeEach((done) => {
vm.file.name = 'file.dat';
vm.file.content = '🐱'; // non-ascii binary content
jest.spyOn(vm.editor, 'createInstance').mockImplementation();
......@@ -227,7 +227,7 @@ describe('RepoEditor', () => {
});
describe('createEditorInstance', () => {
it('calls createInstance when viewer is editor', done => {
it('calls createInstance when viewer is editor', (done) => {
jest.spyOn(vm.editor, 'createInstance').mockImplementation();
vm.createEditorInstance();
......@@ -239,7 +239,7 @@ describe('RepoEditor', () => {
});
});
it('calls createDiffInstance when viewer is diff', done => {
it('calls createDiffInstance when viewer is diff', (done) => {
vm.$store.state.viewer = 'diff';
jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation();
......@@ -253,7 +253,7 @@ describe('RepoEditor', () => {
});
});
it('calls createDiffInstance when viewer is a merge request diff', done => {
it('calls createDiffInstance when viewer is a merge request diff', (done) => {
vm.$store.state.viewer = 'mrdiff';
jest.spyOn(vm.editor, 'createDiffInstance').mockImplementation();
......@@ -354,7 +354,7 @@ describe('RepoEditor', () => {
jest.spyOn(vm.editor, 'updateDiffView').mockImplementation();
});
it('calls updateDimensions when panelResizing is false', done => {
it('calls updateDimensions when panelResizing is false', (done) => {
vm.$store.state.panelResizing = true;
vm.$nextTick()
......@@ -370,7 +370,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
it('does not call updateDimensions when panelResizing is true', done => {
it('does not call updateDimensions when panelResizing is true', (done) => {
vm.$store.state.panelResizing = true;
vm.$nextTick(() => {
......@@ -381,7 +381,7 @@ describe('RepoEditor', () => {
});
});
it('calls updateDimensions when rightPane is opened', done => {
it('calls updateDimensions when rightPane is opened', (done) => {
vm.$store.state.rightPane.isOpen = true;
vm.$nextTick(() => {
......@@ -398,7 +398,7 @@ describe('RepoEditor', () => {
expect(vm.$el.querySelector('.nav-links')).not.toBe(null);
});
it('hides tabs in review mode', done => {
it('hides tabs in review mode', (done) => {
vm.$store.state.currentActivityView = leftSidebarViews.review.name;
vm.$nextTick(() => {
......@@ -408,7 +408,7 @@ describe('RepoEditor', () => {
});
});
it('hides tabs in commit mode', done => {
it('hides tabs in commit mode', (done) => {
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
vm.$nextTick(() => {
......@@ -420,7 +420,7 @@ describe('RepoEditor', () => {
});
describe('when files view mode is preview', () => {
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(vm.editor, 'updateDimensions').mockImplementation();
changeViewMode(FILE_VIEW_MODE_PREVIEW);
vm.file.name = 'myfile.md';
......@@ -452,7 +452,7 @@ describe('RepoEditor', () => {
jest.spyOn(vm, 'shouldHideEditor', 'get').mockReturnValue(true);
});
it('does not fetch file information for temp entries', done => {
it('does not fetch file information for temp entries', (done) => {
vm.file.tempFile = true;
vm.initEditor();
......@@ -464,7 +464,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
it('is being initialised for files without content even if shouldHideEditor is `true`', done => {
it('is being initialised for files without content even if shouldHideEditor is `true`', (done) => {
vm.file.content = '';
vm.file.raw = '';
......@@ -479,7 +479,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
it('does not initialize editor for files already with content', done => {
it('does not initialize editor for files already with content', (done) => {
vm.file.content = 'foo';
vm.initEditor();
......@@ -499,7 +499,7 @@ describe('RepoEditor', () => {
jest.spyOn(vm, 'initEditor').mockImplementation();
});
it('calls removePendingTab when old file is pending', done => {
it('calls removePendingTab when old file is pending', (done) => {
jest.spyOn(vm, 'shouldHideEditor', 'get').mockReturnValue(true);
jest.spyOn(vm, 'removePendingTab').mockImplementation();
......@@ -519,7 +519,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
it('does not call initEditor if the file did not change', done => {
it('does not call initEditor if the file did not change', (done) => {
Vue.set(vm, 'file', vm.file);
vm.$nextTick()
......@@ -530,7 +530,7 @@ describe('RepoEditor', () => {
.catch(done.fail);
});
it('calls initEditor when file key is changed', done => {
it('calls initEditor when file key is changed', (done) => {
expect(vm.initEditor).not.toHaveBeenCalled();
Vue.set(vm, 'file', {
......@@ -552,7 +552,7 @@ describe('RepoEditor', () => {
vm.getRawFileData.mockRestore();
});
const createRemoteFile = name => ({
const createRemoteFile = (name) => ({
...file(name),
tmpFile: false,
});
......@@ -605,7 +605,7 @@ describe('RepoEditor', () => {
});
describe('onPaste', () => {
const setFileName = name => {
const setFileName = (name) => {
Vue.set(vm, 'file', {
...vm.file,
content: 'hello world\n',
......@@ -627,8 +627,8 @@ describe('RepoEditor', () => {
);
};
const watchState = watched =>
new Promise(resolve => {
const watchState = (watched) =>
new Promise((resolve) => {
const unwatch = vm.$store.watch(watched, () => {
unwatch();
resolve();
......@@ -638,7 +638,7 @@ describe('RepoEditor', () => {
// Pasting an image does a lot of things like using the FileReader API,
// so, waitForPromises isn't very reliable (and causes a flaky spec)
// Read more about state.watch: https://vuex.vuejs.org/api/#watch
const waitForFileContentChange = () => watchState(s => s.entries['foo/bar.md'].content);
const waitForFileContentChange = () => watchState((s) => s.entries['foo/bar.md'].content);
beforeEach(() => {
setFileName('bar.md');
......
......@@ -30,7 +30,7 @@ describe('RepoTabs', () => {
wrapper.destroy();
});
it('renders a list of tabs', done => {
it('renders a list of tabs', (done) => {
store.state.openFiles[0].active = true;
wrapper.vm.$nextTick(() => {
......
......@@ -38,7 +38,7 @@ describe('~/ide/components/resizable_panel', () => {
};
const findResizer = () => wrapper.find(PanelResizer);
const findInlineStyle = () => wrapper.element.style.cssText;
const createInlineStyle = width => `width: ${width}px;`;
const createInlineStyle = (width) => `width: ${width}px;`;
describe.each`
props | showResizer | resizerSide | expectedStyle
......
......@@ -44,9 +44,9 @@ describe('IDE shared/TokenedInput', () => {
});
it('renders tokens', () => {
const renderedTokens = getTokenElements(vm).map(x => x.textContent.trim());
const renderedTokens = getTokenElements(vm).map((x) => x.textContent.trim());
expect(renderedTokens).toEqual(TEST_TOKENS.map(x => x.label));
expect(renderedTokens).toEqual(TEST_TOKENS.map((x) => x.label));
});
it('renders input', () => {
......@@ -54,7 +54,7 @@ describe('IDE shared/TokenedInput', () => {
expect(vm.$refs.input).toHaveValue(TEST_VALUE);
});
it('renders placeholder, when tokens are empty', done => {
it('renders placeholder, when tokens are empty', (done) => {
vm.tokens = [];
vm.$nextTick()
......
......@@ -67,7 +67,7 @@ describe('IDE TerminalSession', () => {
});
});
[STARTING, PENDING, RUNNING].forEach(status => {
[STARTING, PENDING, RUNNING].forEach((status) => {
it(`show stop button when status is ${status}`, () => {
state.session = { status };
factory();
......@@ -82,7 +82,7 @@ describe('IDE TerminalSession', () => {
});
});
[STOPPING, STOPPED].forEach(status => {
[STOPPING, STOPPED].forEach((status) => {
it(`show stop button when status is ${status}`, () => {
state.session = { status };
factory();
......
......@@ -17,7 +17,7 @@ describe('IDE TerminalControls', () => {
it('shows an up and down scroll button', () => {
factory();
expect(buttons.wrappers.map(x => x.props())).toEqual([
expect(buttons.wrappers.map((x) => x.props())).toEqual([
expect.objectContaining({ direction: 'up', disabled: true }),
expect.objectContaining({ direction: 'down', disabled: true }),
]);
......
......@@ -31,7 +31,7 @@ describe('IDE Terminal', () => {
let wrapper;
let state;
const factory = propsData => {
const factory = (propsData) => {
const store = new Vuex.Store({
state,
mutations: {
......@@ -63,7 +63,7 @@ describe('IDE Terminal', () => {
});
describe('loading text', () => {
[STARTING, PENDING].forEach(status => {
[STARTING, PENDING].forEach((status) => {
it(`shows when starting (${status})`, () => {
factory({ status });
......@@ -79,7 +79,7 @@ describe('IDE Terminal', () => {
expect(wrapper.find('.top-bar').text()).toBe('Stopping...');
});
[RUNNING, STOPPED].forEach(status => {
[RUNNING, STOPPED].forEach((status) => {
it('hides when not loading', () => {
factory({ status });
......
......@@ -26,7 +26,7 @@ describe('ide/components/terminal_sync/terminal_sync_status', () => {
namespaced: true,
state: moduleState,
mutations: {
[START_LOADING]: state => {
[START_LOADING]: (state) => {
state.isLoading = true;
},
},
......
......@@ -26,7 +26,7 @@ export const createMovedFile = (path, prevPath, content) =>
prevPath,
});
export const createEntries = path =>
export const createEntries = (path) =>
path.split('/').reduce((acc, part, idx, parts) => {
const parentPath = parts.slice(0, idx).join('/');
const fullPath = parentPath ? `${parentPath}/${part}` : part;
......
......@@ -12,9 +12,9 @@ export const file = (name = 'name', id = name, type = '', parent = null) =>
parentPath: parent ? parent.path : '',
});
export const createEntriesFromPaths = paths =>
export const createEntriesFromPaths = (paths) =>
paths
.map(path => ({
.map((path) => ({
name: pathUtils.basename(path),
dir: pathUtils.dirname(path),
ext: pathUtils.extname(path),
......@@ -30,7 +30,7 @@ export const createEntriesFromPaths = paths =>
};
}, {});
export const createTriggerChangeAction = payload => ({
export const createTriggerChangeAction = (payload) => ({
type: 'triggerFilesChange',
...(payload ? { payload } : {}),
});
......
......@@ -4,7 +4,7 @@ import IdeRouter from '~/ide/ide_router_extension';
jest.mock('vue-router');
describe('IDE overrides of VueRouter', () => {
const paths = branch => [
const paths = (branch) => [
`${branch}`,
`/${branch}`,
`/${branch}/-/`,
......@@ -35,7 +35,7 @@ describe('IDE overrides of VueRouter', () => {
${'test-#-hash'} | ${'test-%23-hash'}
${'test/hash#123'} | ${'test/hash%23123'}
`('finds project path when route is $path', ({ path, expected }) => {
paths(path).forEach(route => {
paths(path).forEach((route) => {
const expectedPath = route.replace(path, expected);
router.push(route);
......
......@@ -32,7 +32,7 @@ describe('IDE router', () => {
`/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/tree/blob`,
`/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}/edit`,
`/project/${PROJECT_NAMESPACE}/${PROJECT_NAME}`,
].forEach(route => {
].forEach((route) => {
it(`finds project path when route is "${route}"`, () => {
router.push(route);
......
......@@ -81,7 +81,7 @@ describe('Multi-file editor library model', () => {
});
describe('onChange', () => {
it('calls callback on change', done => {
it('calls callback on change', (done) => {
const spy = jest.fn();
model.onChange(spy);
......
......@@ -145,12 +145,12 @@ new file mode 100644
--- /dev/null
+++ b/${PATH_LOREM}
@@ -0,0 +1,${LINES.length} @@
${LINES.map(line => `+${line}`).join('\n')}
${LINES.map((line) => `+${line}`).join('\n')}
diff --git "a/${PATH_IPSUM}" "b/${PATH_IPSUM}"
--- a/${PATH_IPSUM}
+++ b/${PATH_IPSUM}
@@ -1,${LINES.length} +1,1 @@
${LINES.map(line => `-${line}`).join('\n')}
${LINES.map((line) => `-${line}`).join('\n')}
+That's all folks!
\\ No newline at end of file
`;
......@@ -167,10 +167,10 @@ ${LINES.map(line => `-${line}`).join('\n')}
const deletedFiles = ['foo/bar/zed/test.md', 'foo/bar/zed/test2.md'];
const entries = deletedFiles.reduce((acc, path) => Object.assign(acc, createEntries(path)), {});
const allDeleted = [...deletedFiles, 'foo/bar/zed', 'foo/bar'];
allDeleted.forEach(path => {
allDeleted.forEach((path) => {
entries[path].deleted = true;
});
const changedFiles = deletedFiles.map(x => entries[x]);
const changedFiles = deletedFiles.map((x) => entries[x]);
const result = createDiff({ changedFiles, entries });
......
......@@ -51,7 +51,7 @@ describe('IDE lib/create_file_diff', () => {
const expectedHead = `diff --git "a/${PATH}" "b/${PATH}"
new file mode 100644`;
const expectedChunkHead = lineCount => `--- /dev/null
const expectedChunkHead = (lineCount) => `--- /dev/null
+++ b/${PATH}
@@ -0,0 +1,${lineCount} @@`;
......@@ -86,7 +86,7 @@ ${expectedChunkHead(1)}
expect(result).toBe(`${expectedHead}
${expectedChunkHead(TEXT_LINE_COUNT)}
${mapLines(TEXT, line => `+${line}`)}
${mapLines(TEXT, (line) => `+${line}`)}
`);
});
});
......@@ -95,7 +95,7 @@ ${mapLines(TEXT, line => `+${line}`)}
const expectedHead = `diff --git "a/${PATH}" "b/${PATH}"
deleted file mode 100644`;
const expectedChunkHead = lineCount => `--- a/${PATH}
const expectedChunkHead = (lineCount) => `--- a/${PATH}
+++ /dev/null
@@ -1,${lineCount} +0,0 @@`;
......@@ -111,7 +111,7 @@ deleted file mode 100644`;
expect(result).toBe(`${expectedHead}
${expectedChunkHead(TEXT_LINE_COUNT)}
${mapLines(TEXT, line => `-${line}`)}
${mapLines(TEXT, (line) => `-${line}`)}
`);
});
});
......
......@@ -37,7 +37,7 @@ describe('Multi-file editor library dirty diff controller', () => {
});
describe('getDiffChangeType', () => {
['added', 'removed', 'modified'].forEach(type => {
['added', 'removed', 'modified'].forEach((type) => {
it(`returns ${type}`, () => {
const change = {
[type]: true,
......@@ -49,7 +49,7 @@ describe('Multi-file editor library dirty diff controller', () => {
});
describe('getDecorator', () => {
['added', 'removed', 'modified'].forEach(type => {
['added', 'removed', 'modified'].forEach((type) => {
it(`returns with linesDecorationsClassName for ${type}`, () => {
const change = {
[type]: true,
......
......@@ -15,7 +15,7 @@ describe('Multi-file editor library', () => {
let holder;
let store;
const setNodeOffsetWidth = val => {
const setNodeOffsetWidth = (val) => {
Object.defineProperty(instance.instance.getDomNode(), 'offsetWidth', {
get() {
return val;
......
......@@ -2,14 +2,14 @@ import { getRulesWithTraversal } from '~/ide/lib/editorconfig/parser';
import { exampleConfigs, exampleFiles } from './mock_data';
describe('~/ide/lib/editorconfig/parser', () => {
const getExampleConfigContent = path =>
Promise.resolve(exampleConfigs.find(x => x.path === path)?.content);
const getExampleConfigContent = (path) =>
Promise.resolve(exampleConfigs.find((x) => x.path === path)?.content);
describe('getRulesWithTraversal', () => {
it.each(exampleFiles)(
'traverses through all editorconfig files in parent directories (until root=true is hit) and finds rules for this file (case %#)',
({ path, rules }) => {
return getRulesWithTraversal(path, getExampleConfigContent).then(result => {
return getRulesWithTraversal(path, getExampleConfigContent).then((result) => {
expect(result).toEqual(rules);
});
},
......
......@@ -14,7 +14,7 @@ const CODEOWNERS_MESSAGE =
const CHANGED_MESSAGE = 'Things changed since you started editing';
describe('~/ide/lib/errors', () => {
const createResponseError = message => ({
const createResponseError = (message) => ({
response: {
data: {
message,
......
......@@ -3,7 +3,7 @@ import { decorateData } from '~/ide/stores/utils';
const TEST_BLOB_DATA = { mimeType: 'test/mime' };
const createEntries = paths => {
const createEntries = (paths) => {
const createEntry = (acc, { path, type, children }) => {
const { name, parent } = splitParent(path);
......@@ -15,7 +15,7 @@ const createEntries = paths => {
type,
parentPath: parent,
}),
tree: children.map(childName => expect.objectContaining({ name: childName })),
tree: children.map((childName) => expect.objectContaining({ name: childName })),
...(type === 'blob' ? TEST_BLOB_DATA : {}),
};
......@@ -53,7 +53,7 @@ describe('IDE lib decorate files', () => {
const entryKeys = Object.keys(entries);
expect(entryKeys).toEqual(Object.keys(expectedEntries));
entryKeys.forEach(key => {
entryKeys.forEach((key) => {
expect(entries[key]).toEqual(expectedEntries[key]);
});
......
......@@ -72,7 +72,7 @@ describe('ide/lib/mirror', () => {
});
const waitForConnection = (delay = SERVICE_DELAY) => {
const wait = new Promise(resolve => {
const wait = new Promise((resolve) => {
setTimeout(resolve, 10);
});
......@@ -82,7 +82,7 @@ describe('ide/lib/mirror', () => {
};
const connectPass = () => waitForConnection().then(() => mockWebSocket.onopen());
const connectFail = () => waitForConnection().then(() => mockWebSocket.onerror());
const sendResponse = msg => {
const sendResponse = (msg) => {
mockWebSocket.onmessage(msg);
};
......
......@@ -51,7 +51,7 @@ describe('IDE services', () => {
raw: 'raw content',
};
return services.getRawFileData(file).then(raw => {
return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('content');
});
});
......@@ -65,7 +65,7 @@ describe('IDE services', () => {
raw: 'raw content',
};
return services.getRawFileData(file).then(raw => {
return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('raw content');
});
});
......@@ -77,7 +77,7 @@ describe('IDE services', () => {
raw: 'raw content',
};
return services.getRawFileData(file).then(raw => {
return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('raw content');
});
});
......@@ -89,7 +89,7 @@ describe('IDE services', () => {
raw: '',
};
return services.getRawFileData(file).then(raw => {
return services.getRawFileData(file).then((raw) => {
expect(raw).toBe('');
});
});
......@@ -116,7 +116,7 @@ describe('IDE services', () => {
});
it('sends a request to file.rawPath', () => {
return services.getRawFileData(file).then(raw => {
return services.getRawFileData(file).then((raw) => {
expect(axios.get).toHaveBeenCalledWith(file.rawPath, {
transformResponse: [expect.any(Function)],
});
......@@ -127,7 +127,7 @@ describe('IDE services', () => {
it('returns arraybuffer for binary files', () => {
file.binary = true;
return services.getRawFileData(file).then(raw => {
return services.getRawFileData(file).then((raw) => {
expect(axios.get).toHaveBeenCalledWith(file.rawPath, {
transformResponse: [expect.any(Function)],
responseType: 'arraybuffer',
......@@ -161,7 +161,7 @@ describe('IDE services', () => {
it('gives back file.baseRaw for files with that property present', () => {
file.baseRaw = TEST_FILE_CONTENTS;
return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => {
return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => {
expect(content).toEqual(TEST_FILE_CONTENTS);
});
});
......@@ -170,7 +170,7 @@ describe('IDE services', () => {
file.tempFile = true;
file.baseRaw = TEST_FILE_CONTENTS;
return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => {
return services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => {
expect(content).toEqual(TEST_FILE_CONTENTS);
});
});
......@@ -207,7 +207,7 @@ describe('IDE services', () => {
});
it('fetches file content', () =>
services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then(content => {
services.getBaseRawFileData(file, TEST_PROJECT_ID, TEST_COMMIT_SHA).then((content) => {
expect(content).toEqual(TEST_FILE_CONTENTS);
}));
},
......@@ -224,7 +224,7 @@ describe('IDE services', () => {
Api.project.mockReturnValue(Promise.resolve({ data: { ...projectData } }));
query.mockReturnValue(Promise.resolve({ data: { project: gqlProjectData } }));
return services.getProjectData(TEST_NAMESPACE, TEST_PROJECT).then(response => {
return services.getProjectData(TEST_NAMESPACE, TEST_PROJECT).then((response) => {
expect(response).toEqual({ data: { ...projectData, ...gqlProjectData } });
expect(Api.project).toHaveBeenCalledWith(TEST_PROJECT_ID);
expect(query).toHaveBeenCalledWith({
......
......@@ -189,7 +189,7 @@ describe('IDE store file actions', () => {
});
describe('call to service', () => {
const callExpectation = serviceCalled => {
const callExpectation = (serviceCalled) => {
store.dispatch('getFileData', { path: localFile.path });
if (serviceCalled) {
......@@ -422,11 +422,11 @@ describe('IDE store file actions', () => {
loadingWhenGettingRawData = undefined;
loadingWhenGettingBaseRawData = undefined;
jest.spyOn(service, 'getRawFileData').mockImplementation(f => {
jest.spyOn(service, 'getRawFileData').mockImplementation((f) => {
loadingWhenGettingRawData = f.loading;
return Promise.resolve('raw');
});
jest.spyOn(service, 'getBaseRawFileData').mockImplementation(f => {
jest.spyOn(service, 'getBaseRawFileData').mockImplementation((f) => {
loadingWhenGettingBaseRawData = f.loading;
return Promise.resolve('rawBase');
});
......@@ -743,7 +743,7 @@ describe('IDE store file actions', () => {
});
it('returns true when opened', () => {
return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(added => {
return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then((added) => {
expect(added).toBe(true);
});
});
......@@ -755,7 +755,7 @@ describe('IDE store file actions', () => {
key: `pending-${f.key}`,
});
return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then(added => {
return store.dispatch('openPendingTab', { file: f, keyPrefix: 'pending' }).then((added) => {
expect(added).toBe(false);
});
});
......
......@@ -49,7 +49,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).reply(200, mockData);
});
it('calls getProjectMergeRequests service method', done => {
it('calls getProjectMergeRequests service method', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
......@@ -66,7 +66,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('sets the "Merge Request" Object', done => {
it('sets the "Merge Request" Object', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
......@@ -78,7 +78,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('sets "Current Merge Request" object to the most recent MR', done => {
it('sets "Current Merge Request" object to the most recent MR', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.then(() => {
......@@ -88,7 +88,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('does nothing if user cannot read MRs', done => {
it('does nothing if user cannot read MRs', (done) => {
store.state.projects[TEST_PROJECT].userPermissions[PERMISSION_READ_MR] = false;
store
......@@ -108,7 +108,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).reply(200, []);
});
it('does not fail if there are no merge requests for current branch', done => {
it('does not fail if there are no merge requests for current branch', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'foo' })
.then(() => {
......@@ -126,7 +126,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests/).networkError();
});
it('flashes message, if error', done => {
it('flashes message, if error', (done) => {
store
.dispatch('getMergeRequestsForBranch', { projectId: TEST_PROJECT, branchId: 'bar' })
.catch(() => {
......@@ -149,7 +149,7 @@ describe('IDE store merge request actions', () => {
.reply(200, { title: 'mergerequest' });
});
it('calls getProjectMergeRequestData service method', done => {
it('calls getProjectMergeRequestData service method', (done) => {
store
.dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
......@@ -160,7 +160,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('sets the Merge Request Object', done => {
it('sets the Merge Request Object', (done) => {
store
.dispatch('getMergeRequestData', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
......@@ -180,7 +180,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1/).networkError();
});
it('dispatches error action', done => {
it('dispatches error action', (done) => {
const dispatch = jest.fn();
getMergeRequestData(
......@@ -224,7 +224,7 @@ describe('IDE store merge request actions', () => {
.reply(200, { title: 'mergerequest' });
});
it('calls getProjectMergeRequestChanges service method', done => {
it('calls getProjectMergeRequestChanges service method', (done) => {
store
.dispatch('getMergeRequestChanges', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
......@@ -235,7 +235,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('sets the Merge Request Changes Object', done => {
it('sets the Merge Request Changes Object', (done) => {
store
.dispatch('getMergeRequestChanges', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
......@@ -253,7 +253,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1\/changes/).networkError();
});
it('dispatches error action', done => {
it('dispatches error action', (done) => {
const dispatch = jest.fn();
getMergeRequestChanges(
......@@ -296,7 +296,7 @@ describe('IDE store merge request actions', () => {
jest.spyOn(service, 'getProjectMergeRequestVersions');
});
it('calls getProjectMergeRequestVersions service method', done => {
it('calls getProjectMergeRequestVersions service method', (done) => {
store
.dispatch('getMergeRequestVersions', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
......@@ -307,7 +307,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('sets the Merge Request Versions Object', done => {
it('sets the Merge Request Versions Object', (done) => {
store
.dispatch('getMergeRequestVersions', { projectId: TEST_PROJECT, mergeRequestId: 1 })
.then(() => {
......@@ -323,7 +323,7 @@ describe('IDE store merge request actions', () => {
mock.onGet(/api\/(.*)\/projects\/abcproject\/merge_requests\/1\/versions/).networkError();
});
it('dispatches error action', done => {
it('dispatches error action', (done) => {
const dispatch = jest.fn();
getMergeRequestVersions(
......@@ -422,7 +422,7 @@ describe('IDE store merge request actions', () => {
);
});
it('dispatches actions for merge request data', done => {
it('dispatches actions for merge request data', (done) => {
openMergeRequest({ state: store.state, dispatch: store.dispatch, getters: mockGetters }, mr)
.then(() => {
expect(store.dispatch.mock.calls).toEqual([
......@@ -451,7 +451,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('updates activity bar view and gets file data, if changes are found', done => {
it('updates activity bar view and gets file data, if changes are found', (done) => {
store.state.entries.foo = {
type: 'blob',
};
......@@ -490,7 +490,7 @@ describe('IDE store merge request actions', () => {
.catch(done.fail);
});
it('flashes message, if error', done => {
it('flashes message, if error', (done) => {
store.dispatch.mockRejectedValue();
openMergeRequest(store, mr)
......
......@@ -53,7 +53,7 @@ describe('IDE store project actions', () => {
});
});
it('calls the service', done => {
it('calls the service', (done) => {
store
.dispatch('refreshLastCommitData', {
projectId: store.state.currentProjectId,
......@@ -67,7 +67,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
it('commits getBranchData', done => {
it('commits getBranchData', (done) => {
testAction(
refreshLastCommitData,
{
......@@ -94,7 +94,7 @@ describe('IDE store project actions', () => {
});
describe('showBranchNotFoundError', () => {
it('dispatches setErrorMessage', done => {
it('dispatches setErrorMessage', (done) => {
testAction(
showBranchNotFoundError,
'master',
......@@ -123,7 +123,7 @@ describe('IDE store project actions', () => {
jest.spyOn(api, 'createBranch').mockResolvedValue();
});
it('calls API', done => {
it('calls API', (done) => {
createNewBranchFromDefault(
{
state: {
......@@ -148,7 +148,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
it('clears error message', done => {
it('clears error message', (done) => {
const dispatchSpy = jest.fn().mockName('dispatch');
createNewBranchFromDefault(
......@@ -172,7 +172,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
it('reloads window', done => {
it('reloads window', (done) => {
createNewBranchFromDefault(
{
state: {
......@@ -196,7 +196,7 @@ describe('IDE store project actions', () => {
});
describe('loadEmptyBranch', () => {
it('creates a blank tree and sets loading state to false', done => {
it('creates a blank tree and sets loading state to false', (done) => {
testAction(
loadEmptyBranch,
{ projectId: TEST_PROJECT_ID, branchId: 'master' },
......@@ -213,7 +213,7 @@ describe('IDE store project actions', () => {
);
});
it('does nothing, if tree already exists', done => {
it('does nothing, if tree already exists', (done) => {
const trees = { [`${TEST_PROJECT_ID}/master`]: [] };
testAction(
......@@ -279,7 +279,7 @@ describe('IDE store project actions', () => {
const branchId = '123-lorem';
const ref = 'abcd2322';
it('when empty repo, loads empty branch', done => {
it('when empty repo, loads empty branch', (done) => {
const mockGetters = { emptyRepo: true };
testAction(
......@@ -292,13 +292,13 @@ describe('IDE store project actions', () => {
);
});
it('when branch already exists, does nothing', done => {
it('when branch already exists, does nothing', (done) => {
store.state.projects[projectId].branches[branchId] = {};
testAction(loadBranch, { projectId, branchId }, store.state, [], [], done);
});
it('fetches branch data', done => {
it('fetches branch data', (done) => {
const mockGetters = { findBranch: () => ({ commit: { id: ref } }) };
jest.spyOn(store, 'dispatch').mockResolvedValue();
......@@ -317,7 +317,7 @@ describe('IDE store project actions', () => {
.catch(done.fail);
});
it('shows an error if branch can not be fetched', done => {
it('shows an error if branch can not be fetched', (done) => {
jest.spyOn(store, 'dispatch').mockReturnValue(Promise.reject());
loadBranch(store, { projectId, branchId })
......@@ -356,7 +356,7 @@ describe('IDE store project actions', () => {
jest.spyOn(store, 'dispatch').mockResolvedValue();
});
it('dispatches branch actions', done => {
it('dispatches branch actions', (done) => {
openBranch(store, branch)
.then(() => {
expect(store.dispatch.mock.calls).toEqual([
......@@ -375,9 +375,9 @@ describe('IDE store project actions', () => {
jest.spyOn(store, 'dispatch').mockReturnValue(Promise.reject());
});
it('dispatches correct branch actions', done => {
it('dispatches correct branch actions', (done) => {
openBranch(store, branch)
.then(val => {
.then((val) => {
expect(store.dispatch.mock.calls).toEqual([
['setCurrentBranchId', branchId],
['loadBranch', { projectId, branchId }],
......
......@@ -68,7 +68,7 @@ describe('Multi-file store tree actions', () => {
);
});
it('adds data into tree', done => {
it('adds data into tree', (done) => {
store
.dispatch('getFiles', basicCallParameters)
.then(() => {
......@@ -93,7 +93,7 @@ describe('Multi-file store tree actions', () => {
});
describe('error', () => {
it('dispatches error action', done => {
it('dispatches error action', (done) => {
const dispatch = jest.fn();
store.state.projects = {
......@@ -148,7 +148,7 @@ describe('Multi-file store tree actions', () => {
store.state.entries[tree.path] = tree;
});
it('toggles the tree open', done => {
it('toggles the tree open', (done) => {
store
.dispatch('toggleTreeOpen', tree.path)
.then(() => {
......@@ -174,7 +174,7 @@ describe('Multi-file store tree actions', () => {
Object.assign(store.state.entries, createEntriesFromPaths(paths));
});
it('opens the parents', done => {
it('opens the parents', (done) => {
testAction(
showTreeEntry,
'grandparent/parent/child.txt',
......@@ -187,7 +187,7 @@ describe('Multi-file store tree actions', () => {
});
describe('setDirectoryData', () => {
it('sets tree correctly if there are no opened files yet', done => {
it('sets tree correctly if there are no opened files yet', (done) => {
const treeFile = file({ name: 'README.md' });
store.state.trees['abcproject/master'] = {};
......
This diff is collapsed.
......@@ -15,7 +15,7 @@ describe('ide/stores/extend', () => {
store = {};
el = {};
[terminalPlugin, terminalSyncPlugin].forEach(x => {
[terminalPlugin, terminalSyncPlugin].forEach((x) => {
const plugin = jest.fn();
x.mockImplementation(() => plugin);
......@@ -28,7 +28,7 @@ describe('ide/stores/extend', () => {
terminalSyncPlugin.mockClear();
});
const withGonFeatures = features => {
const withGonFeatures = (features) => {
global.gon = { ...global.gon, features };
};
......
......@@ -407,7 +407,7 @@ describe('IDE store getters', () => {
${'canCreateMergeRequests'} | ${'createMergeRequestIn'}
${'canPushCode'} | ${'pushCode'}
`('$getterName', ({ getterName, permissionKey }) => {
it.each([true, false])('finds permission for current project (%s)', val => {
it.each([true, false])('finds permission for current project (%s)', (val) => {
localState.projects[TEST_PROJECT_ID] = {
userPermissions: {
[permissionKey]: val,
......
......@@ -84,7 +84,7 @@ describe('IDE store integration', () => {
store.dispatch('commit/updateFilesAfterCommit', { data: {} });
expect(store.state.entries[TEST_PATH]).toEqual(expected);
expect(store.state.entries[TEST_PATH_DIR].tree.find(x => x.path === TEST_PATH)).toEqual(
expect(store.state.entries[TEST_PATH_DIR].tree.find((x) => x.path === TEST_PATH)).toEqual(
expected,
);
});
......
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