Commit 58c9a083 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Add mock.restore for axios

parent 77e043e2
...@@ -107,18 +107,17 @@ describe('Code navigation actions', () => { ...@@ -107,18 +107,17 @@ describe('Code navigation actions', () => {
}, },
], ],
[], [],
) ).then(() => {
.then(() => { expect(addInteractionClass).toHaveBeenCalledWith({
expect(addInteractionClass).toHaveBeenCalledWith({ path: 'index.js',
path: 'index.js', d: {
d: { start_line: 0,
start_line: 0, start_char: 0,
start_char: 0, hover: { value: '123' },
hover: { value: '123' }, },
}, wrapTextNodes,
wrapTextNodes,
});
}); });
});
}); });
}); });
......
...@@ -206,9 +206,7 @@ describe('content_editor/extensions/attachment', () => { ...@@ -206,9 +206,7 @@ describe('content_editor/extensions/attachment', () => {
return new Promise((resolve) => { return new Promise((resolve) => {
eventHub.$on('alert', ({ message, variant }) => { eventHub.$on('alert', ({ message, variant }) => {
expect(variant).toBe(VARIANT_DANGER); expect(variant).toBe(VARIANT_DANGER);
expect(message).toBe( expect(message).toBe('An error occurred while uploading the file. Please try again.');
'An error occurred while uploading the file. Please try again.',
);
resolve(); resolve();
}); });
}); });
......
...@@ -9,46 +9,7 @@ import { ...@@ -9,46 +9,7 @@ import {
INLINE_DIFF_VIEW_TYPE, INLINE_DIFF_VIEW_TYPE,
PARALLEL_DIFF_VIEW_TYPE, PARALLEL_DIFF_VIEW_TYPE,
} from '~/diffs/constants'; } from '~/diffs/constants';
import { import * as diffActions from '~/diffs/store/actions';
setBaseConfig,
fetchDiffFilesBatch,
fetchDiffFilesMeta,
fetchCoverageFiles,
assignDiscussionsToDiff,
removeDiscussionsFromDiff,
startRenderDiffsQueue,
setInlineDiffViewType,
setParallelDiffViewType,
showCommentForm,
cancelCommentForm,
loadMoreLines,
scrollToLineIfNeededInline,
scrollToLineIfNeededParallel,
loadCollapsedDiff,
toggleFileDiscussions,
saveDiffDiscussion,
setHighlightedRow,
toggleTreeOpen,
scrollToFile,
setShowTreeList,
renderFileForDiscussionId,
setRenderTreeList,
setShowWhitespace,
setRenderIt,
receiveFullDiffError,
fetchFullDiff,
toggleFullDiff,
switchToFullDiffFromRenamedFile,
setFileCollapsedByUser,
setExpandedDiffLines,
setSuggestPopoverDismissed,
changeCurrentCommit,
moveToNeighboringCommit,
setCurrentDiffFileIdFromNote,
navigateToDiffFileIndex,
setFileByFile,
reviewFile,
} from '~/diffs/store/actions';
import * as types from '~/diffs/store/mutation_types'; import * as types from '~/diffs/store/mutation_types';
import * as utils from '~/diffs/store/utils'; import * as utils from '~/diffs/store/utils';
import * as treeWorkerUtils from '~/diffs/utils/tree_worker_utils'; import * as treeWorkerUtils from '~/diffs/utils/tree_worker_utils';
...@@ -62,6 +23,8 @@ import { diffMetadata } from '../mock_data/diff_metadata'; ...@@ -62,6 +23,8 @@ import { diffMetadata } from '../mock_data/diff_metadata';
jest.mock('~/flash'); jest.mock('~/flash');
describe('DiffsStoreActions', () => { describe('DiffsStoreActions', () => {
let mock;
useLocalStorageSpy(); useLocalStorageSpy();
const originalMethods = { const originalMethods = {
...@@ -83,11 +46,16 @@ describe('DiffsStoreActions', () => { ...@@ -83,11 +46,16 @@ describe('DiffsStoreActions', () => {
}); });
}); });
beforeEach(() => {
mock = new MockAdapter(axios);
});
afterEach(() => { afterEach(() => {
['requestAnimationFrame', 'requestIdleCallback'].forEach((method) => { ['requestAnimationFrame', 'requestIdleCallback'].forEach((method) => {
global[method] = originalMethods[method]; global[method] = originalMethods[method];
}); });
createFlash.mockClear(); createFlash.mockClear();
mock.restore();
}); });
describe('setBaseConfig', () => { describe('setBaseConfig', () => {
...@@ -105,7 +73,7 @@ describe('DiffsStoreActions', () => { ...@@ -105,7 +73,7 @@ describe('DiffsStoreActions', () => {
}; };
return testAction( return testAction(
setBaseConfig, diffActions.setBaseConfig,
{ {
endpoint, endpoint,
endpointBatch, endpointBatch,
...@@ -158,16 +126,6 @@ describe('DiffsStoreActions', () => { ...@@ -158,16 +126,6 @@ describe('DiffsStoreActions', () => {
}); });
describe('fetchDiffFilesBatch', () => { describe('fetchDiffFilesBatch', () => {
let mock;
beforeEach(() => {
mock = new MockAdapter(axios);
});
afterEach(() => {
mock.restore();
});
it('should fetch batch diff files', () => { it('should fetch batch diff files', () => {
const endpointBatch = '/fetch/diffs_batch'; const endpointBatch = '/fetch/diffs_batch';
const res1 = { diff_files: [{ file_hash: 'test' }], pagination: { total_pages: 7 } }; const res1 = { diff_files: [{ file_hash: 'test' }], pagination: { total_pages: 7 } };
...@@ -199,7 +157,7 @@ describe('DiffsStoreActions', () => { ...@@ -199,7 +157,7 @@ describe('DiffsStoreActions', () => {
.reply(200, res2); .reply(200, res2);
return testAction( return testAction(
fetchDiffFilesBatch, diffActions.fetchDiffFilesBatch,
{}, {},
{ endpointBatch, diffViewType: 'inline', diffFiles: [] }, { endpointBatch, diffViewType: 'inline', diffFiles: [] },
[ [
...@@ -227,13 +185,14 @@ describe('DiffsStoreActions', () => { ...@@ -227,13 +185,14 @@ describe('DiffsStoreActions', () => {
({ viewStyle, otherView }) => { ({ viewStyle, otherView }) => {
const endpointBatch = '/fetch/diffs_batch'; const endpointBatch = '/fetch/diffs_batch';
fetchDiffFilesBatch({ diffActions
commit: () => {}, .fetchDiffFilesBatch({
state: { commit: () => {},
endpointBatch: `${endpointBatch}?view=${otherView}`, state: {
diffViewType: viewStyle, endpointBatch: `${endpointBatch}?view=${otherView}`,
}, diffViewType: viewStyle,
}) },
})
.then(() => { .then(() => {
expect(mock.history.get[0].url).toContain(`view=${viewStyle}`); expect(mock.history.get[0].url).toContain(`view=${viewStyle}`);
expect(mock.history.get[0].url).not.toContain(`view=${otherView}`); expect(mock.history.get[0].url).not.toContain(`view=${otherView}`);
...@@ -246,11 +205,8 @@ describe('DiffsStoreActions', () => { ...@@ -246,11 +205,8 @@ describe('DiffsStoreActions', () => {
describe('fetchDiffFilesMeta', () => { describe('fetchDiffFilesMeta', () => {
const endpointMetadata = '/fetch/diffs_metadata.json?view=inline'; const endpointMetadata = '/fetch/diffs_metadata.json?view=inline';
const noFilesData = { ...diffMetadata }; const noFilesData = { ...diffMetadata };
let mock;
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
delete noFilesData.diff_files; delete noFilesData.diff_files;
mock.onGet(endpointMetadata).reply(200, diffMetadata); mock.onGet(endpointMetadata).reply(200, diffMetadata);
...@@ -258,7 +214,7 @@ describe('DiffsStoreActions', () => { ...@@ -258,7 +214,7 @@ describe('DiffsStoreActions', () => {
it('should fetch diff meta information', () => { it('should fetch diff meta information', () => {
return testAction( return testAction(
fetchDiffFilesMeta, diffActions.fetchDiffFilesMeta,
{}, {},
{ endpointMetadata, diffViewType: 'inline' }, { endpointMetadata, diffViewType: 'inline' },
[ [
...@@ -278,22 +234,15 @@ describe('DiffsStoreActions', () => { ...@@ -278,22 +234,15 @@ describe('DiffsStoreActions', () => {
}); });
describe('fetchCoverageFiles', () => { describe('fetchCoverageFiles', () => {
let mock;
const endpointCoverage = '/fetch'; const endpointCoverage = '/fetch';
beforeEach(() => {
mock = new MockAdapter(axios);
});
afterEach(() => mock.restore());
it('should commit SET_COVERAGE_DATA with received response', () => { it('should commit SET_COVERAGE_DATA with received response', () => {
const data = { files: { 'app.js': { 1: 0, 2: 1 } } }; const data = { files: { 'app.js': { 1: 0, 2: 1 } } };
mock.onGet(endpointCoverage).reply(200, { data }); mock.onGet(endpointCoverage).reply(200, { data });
return testAction( return testAction(
fetchCoverageFiles, diffActions.fetchCoverageFiles,
{}, {},
{ endpointCoverage }, { endpointCoverage },
[{ type: types.SET_COVERAGE_DATA, payload: { data } }], [{ type: types.SET_COVERAGE_DATA, payload: { data } }],
...@@ -304,7 +253,7 @@ describe('DiffsStoreActions', () => { ...@@ -304,7 +253,7 @@ describe('DiffsStoreActions', () => {
it('should show flash on API error', async () => { it('should show flash on API error', async () => {
mock.onGet(endpointCoverage).reply(400); mock.onGet(endpointCoverage).reply(400);
await testAction(fetchCoverageFiles, {}, { endpointCoverage }, [], []); await testAction(diffActions.fetchCoverageFiles, {}, { endpointCoverage }, [], []);
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith({ expect(createFlash).toHaveBeenCalledWith({
message: expect.stringMatching('Something went wrong'), message: expect.stringMatching('Something went wrong'),
...@@ -314,7 +263,7 @@ describe('DiffsStoreActions', () => { ...@@ -314,7 +263,7 @@ describe('DiffsStoreActions', () => {
describe('setHighlightedRow', () => { describe('setHighlightedRow', () => {
it('should mark currently selected diff and set lineHash and fileHash of highlightedRow', () => { it('should mark currently selected diff and set lineHash and fileHash of highlightedRow', () => {
testAction(setHighlightedRow, 'ABC_123', {}, [ return testAction(diffActions.setHighlightedRow, 'ABC_123', {}, [
{ type: types.SET_HIGHLIGHTED_ROW, payload: 'ABC_123' }, { type: types.SET_HIGHLIGHTED_ROW, payload: 'ABC_123' },
{ type: types.SET_CURRENT_DIFF_FILE, payload: 'ABC' }, { type: types.SET_CURRENT_DIFF_FILE, payload: 'ABC' },
]); ]);
...@@ -389,7 +338,7 @@ describe('DiffsStoreActions', () => { ...@@ -389,7 +338,7 @@ describe('DiffsStoreActions', () => {
const discussions = [singleDiscussion]; const discussions = [singleDiscussion];
return testAction( return testAction(
assignDiscussionsToDiff, diffActions.assignDiscussionsToDiff,
discussions, discussions,
state, state,
[ [
...@@ -423,7 +372,7 @@ describe('DiffsStoreActions', () => { ...@@ -423,7 +372,7 @@ describe('DiffsStoreActions', () => {
window.location.hash = 'note_123'; window.location.hash = 'note_123';
return testAction( return testAction(
assignDiscussionsToDiff, diffActions.assignDiscussionsToDiff,
[], [],
{ diffFiles: [] }, { diffFiles: [] },
[], [],
...@@ -470,7 +419,7 @@ describe('DiffsStoreActions', () => { ...@@ -470,7 +419,7 @@ describe('DiffsStoreActions', () => {
}; };
return testAction( return testAction(
removeDiscussionsFromDiff, diffActions.removeDiscussionsFromDiff,
singleDiscussion, singleDiscussion,
state, state,
[ [
...@@ -516,7 +465,7 @@ describe('DiffsStoreActions', () => { ...@@ -516,7 +465,7 @@ describe('DiffsStoreActions', () => {
}); });
}; };
startRenderDiffsQueue({ state, commit: pseudoCommit }); diffActions.startRenderDiffsQueue({ state, commit: pseudoCommit });
expect(state.diffFiles[0].renderIt).toBe(true); expect(state.diffFiles[0].renderIt).toBe(true);
expect(state.diffFiles[1].renderIt).toBe(true); expect(state.diffFiles[1].renderIt).toBe(true);
...@@ -526,7 +475,7 @@ describe('DiffsStoreActions', () => { ...@@ -526,7 +475,7 @@ describe('DiffsStoreActions', () => {
describe('setInlineDiffViewType', () => { describe('setInlineDiffViewType', () => {
it('should set diff view type to inline and also set the cookie properly', async () => { it('should set diff view type to inline and also set the cookie properly', async () => {
await testAction( await testAction(
setInlineDiffViewType, diffActions.setInlineDiffViewType,
null, null,
{}, {},
[{ type: types.SET_DIFF_VIEW_TYPE, payload: INLINE_DIFF_VIEW_TYPE }], [{ type: types.SET_DIFF_VIEW_TYPE, payload: INLINE_DIFF_VIEW_TYPE }],
...@@ -539,7 +488,7 @@ describe('DiffsStoreActions', () => { ...@@ -539,7 +488,7 @@ describe('DiffsStoreActions', () => {
describe('setParallelDiffViewType', () => { describe('setParallelDiffViewType', () => {
it('should set diff view type to parallel and also set the cookie properly', async () => { it('should set diff view type to parallel and also set the cookie properly', async () => {
await testAction( await testAction(
setParallelDiffViewType, diffActions.setParallelDiffViewType,
null, null,
{}, {},
[{ type: types.SET_DIFF_VIEW_TYPE, payload: PARALLEL_DIFF_VIEW_TYPE }], [{ type: types.SET_DIFF_VIEW_TYPE, payload: PARALLEL_DIFF_VIEW_TYPE }],
...@@ -554,7 +503,7 @@ describe('DiffsStoreActions', () => { ...@@ -554,7 +503,7 @@ describe('DiffsStoreActions', () => {
const payload = { lineCode: 'lineCode', fileHash: 'hash' }; const payload = { lineCode: 'lineCode', fileHash: 'hash' };
return testAction( return testAction(
showCommentForm, diffActions.showCommentForm,
payload, payload,
{}, {},
[{ type: types.TOGGLE_LINE_HAS_FORM, payload: { ...payload, hasForm: true } }], [{ type: types.TOGGLE_LINE_HAS_FORM, payload: { ...payload, hasForm: true } }],
...@@ -568,7 +517,7 @@ describe('DiffsStoreActions', () => { ...@@ -568,7 +517,7 @@ describe('DiffsStoreActions', () => {
const payload = { lineCode: 'lineCode', fileHash: 'hash' }; const payload = { lineCode: 'lineCode', fileHash: 'hash' };
return testAction( return testAction(
cancelCommentForm, diffActions.cancelCommentForm,
payload, payload,
{}, {},
[{ type: types.TOGGLE_LINE_HAS_FORM, payload: { ...payload, hasForm: false } }], [{ type: types.TOGGLE_LINE_HAS_FORM, payload: { ...payload, hasForm: false } }],
...@@ -586,12 +535,11 @@ describe('DiffsStoreActions', () => { ...@@ -586,12 +535,11 @@ describe('DiffsStoreActions', () => {
const isExpandDown = false; const isExpandDown = false;
const nextLineNumbers = {}; const nextLineNumbers = {};
const options = { endpoint, params, lineNumbers, fileHash, isExpandDown, nextLineNumbers }; const options = { endpoint, params, lineNumbers, fileHash, isExpandDown, nextLineNumbers };
const mock = new MockAdapter(axios);
const contextLines = { contextLines: [{ lineCode: 6 }] }; const contextLines = { contextLines: [{ lineCode: 6 }] };
mock.onGet(endpoint).reply(200, contextLines); mock.onGet(endpoint).reply(200, contextLines);
return testAction( return testAction(
loadMoreLines, diffActions.loadMoreLines,
options, options,
{}, {},
[ [
...@@ -610,15 +558,14 @@ describe('DiffsStoreActions', () => { ...@@ -610,15 +558,14 @@ describe('DiffsStoreActions', () => {
it('should fetch data and call mutation with response and the give parameter', () => { it('should fetch data and call mutation with response and the give parameter', () => {
const file = { hash: 123, load_collapsed_diff_url: '/load/collapsed/diff/url' }; const file = { hash: 123, load_collapsed_diff_url: '/load/collapsed/diff/url' };
const data = { hash: 123, parallelDiffLines: [{ lineCode: 1 }] }; const data = { hash: 123, parallelDiffLines: [{ lineCode: 1 }] };
const mock = new MockAdapter(axios);
const commit = jest.fn(); const commit = jest.fn();
mock.onGet(file.loadCollapsedDiffUrl).reply(200, data); mock.onGet(file.loadCollapsedDiffUrl).reply(200, data);
return loadCollapsedDiff({ commit, getters: { commitId: null }, state }, file).then(() => { return diffActions
expect(commit).toHaveBeenCalledWith(types.ADD_COLLAPSED_DIFFS, { file, data }); .loadCollapsedDiff({ commit, getters: { commitId: null }, state }, file)
.then(() => {
mock.restore(); expect(commit).toHaveBeenCalledWith(types.ADD_COLLAPSED_DIFFS, { file, data });
}); });
}); });
it('should fetch data without commit ID', () => { it('should fetch data without commit ID', () => {
...@@ -629,7 +576,7 @@ describe('DiffsStoreActions', () => { ...@@ -629,7 +576,7 @@ describe('DiffsStoreActions', () => {
jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve({ data: {} })); jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve({ data: {} }));
loadCollapsedDiff({ commit() {}, getters, state }, file); diffActions.loadCollapsedDiff({ commit() {}, getters, state }, file);
expect(axios.get).toHaveBeenCalledWith(file.load_collapsed_diff_url, { expect(axios.get).toHaveBeenCalledWith(file.load_collapsed_diff_url, {
params: { commit_id: null, w: '0' }, params: { commit_id: null, w: '0' },
...@@ -644,7 +591,7 @@ describe('DiffsStoreActions', () => { ...@@ -644,7 +591,7 @@ describe('DiffsStoreActions', () => {
jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve({ data: {} })); jest.spyOn(axios, 'get').mockReturnValue(Promise.resolve({ data: {} }));
loadCollapsedDiff({ commit() {}, getters, state }, file); diffActions.loadCollapsedDiff({ commit() {}, getters, state }, file);
expect(axios.get).toHaveBeenCalledWith(file.load_collapsed_diff_url, { expect(axios.get).toHaveBeenCalledWith(file.load_collapsed_diff_url, {
params: { commit_id: '123', w: '0' }, params: { commit_id: '123', w: '0' },
...@@ -662,7 +609,7 @@ describe('DiffsStoreActions', () => { ...@@ -662,7 +609,7 @@ describe('DiffsStoreActions', () => {
const dispatch = jest.fn(); const dispatch = jest.fn();
toggleFileDiscussions({ getters, dispatch }); diffActions.toggleFileDiscussions({ getters, dispatch });
expect(dispatch).toHaveBeenCalledWith( expect(dispatch).toHaveBeenCalledWith(
'collapseDiscussion', 'collapseDiscussion',
...@@ -680,7 +627,7 @@ describe('DiffsStoreActions', () => { ...@@ -680,7 +627,7 @@ describe('DiffsStoreActions', () => {
const dispatch = jest.fn(); const dispatch = jest.fn();
toggleFileDiscussions({ getters, dispatch }); diffActions.toggleFileDiscussions({ getters, dispatch });
expect(dispatch).toHaveBeenCalledWith( expect(dispatch).toHaveBeenCalledWith(
'expandDiscussion', 'expandDiscussion',
...@@ -698,7 +645,7 @@ describe('DiffsStoreActions', () => { ...@@ -698,7 +645,7 @@ describe('DiffsStoreActions', () => {
const dispatch = jest.fn(); const dispatch = jest.fn();
toggleFileDiscussions({ getters, dispatch }); diffActions.toggleFileDiscussions({ getters, dispatch });
expect(dispatch).toHaveBeenCalledWith( expect(dispatch).toHaveBeenCalledWith(
'expandDiscussion', 'expandDiscussion',
...@@ -716,7 +663,7 @@ describe('DiffsStoreActions', () => { ...@@ -716,7 +663,7 @@ describe('DiffsStoreActions', () => {
it('should not call handleLocationHash when there is not hash', () => { it('should not call handleLocationHash when there is not hash', () => {
window.location.hash = ''; window.location.hash = '';
scrollToLineIfNeededInline({}, lineMock); diffActions.scrollToLineIfNeededInline({}, lineMock);
expect(commonUtils.handleLocationHash).not.toHaveBeenCalled(); expect(commonUtils.handleLocationHash).not.toHaveBeenCalled();
}); });
...@@ -724,7 +671,7 @@ describe('DiffsStoreActions', () => { ...@@ -724,7 +671,7 @@ describe('DiffsStoreActions', () => {
it('should not call handleLocationHash when the hash does not match any line', () => { it('should not call handleLocationHash when the hash does not match any line', () => {
window.location.hash = 'XYZ_456'; window.location.hash = 'XYZ_456';
scrollToLineIfNeededInline({}, lineMock); diffActions.scrollToLineIfNeededInline({}, lineMock);
expect(commonUtils.handleLocationHash).not.toHaveBeenCalled(); expect(commonUtils.handleLocationHash).not.toHaveBeenCalled();
}); });
...@@ -732,14 +679,14 @@ describe('DiffsStoreActions', () => { ...@@ -732,14 +679,14 @@ describe('DiffsStoreActions', () => {
it('should call handleLocationHash only when the hash matches a line', () => { it('should call handleLocationHash only when the hash matches a line', () => {
window.location.hash = 'ABC_123'; window.location.hash = 'ABC_123';
scrollToLineIfNeededInline( diffActions.scrollToLineIfNeededInline(
{}, {},
{ {
lineCode: 'ABC_456', lineCode: 'ABC_456',
}, },
); );
scrollToLineIfNeededInline({}, lineMock); diffActions.scrollToLineIfNeededInline({}, lineMock);
scrollToLineIfNeededInline( diffActions.scrollToLineIfNeededInline(
{}, {},
{ {
lineCode: 'XYZ_456', lineCode: 'XYZ_456',
...@@ -762,7 +709,7 @@ describe('DiffsStoreActions', () => { ...@@ -762,7 +709,7 @@ describe('DiffsStoreActions', () => {
it('should not call handleLocationHash when there is not hash', () => { it('should not call handleLocationHash when there is not hash', () => {
window.location.hash = ''; window.location.hash = '';
scrollToLineIfNeededParallel({}, lineMock); diffActions.scrollToLineIfNeededParallel({}, lineMock);
expect(commonUtils.handleLocationHash).not.toHaveBeenCalled(); expect(commonUtils.handleLocationHash).not.toHaveBeenCalled();
}); });
...@@ -770,7 +717,7 @@ describe('DiffsStoreActions', () => { ...@@ -770,7 +717,7 @@ describe('DiffsStoreActions', () => {
it('should not call handleLocationHash when the hash does not match any line', () => { it('should not call handleLocationHash when the hash does not match any line', () => {
window.location.hash = 'XYZ_456'; window.location.hash = 'XYZ_456';
scrollToLineIfNeededParallel({}, lineMock); diffActions.scrollToLineIfNeededParallel({}, lineMock);
expect(commonUtils.handleLocationHash).not.toHaveBeenCalled(); expect(commonUtils.handleLocationHash).not.toHaveBeenCalled();
}); });
...@@ -778,7 +725,7 @@ describe('DiffsStoreActions', () => { ...@@ -778,7 +725,7 @@ describe('DiffsStoreActions', () => {
it('should call handleLocationHash only when the hash matches a line', () => { it('should call handleLocationHash only when the hash matches a line', () => {
window.location.hash = 'ABC_123'; window.location.hash = 'ABC_123';
scrollToLineIfNeededParallel( diffActions.scrollToLineIfNeededParallel(
{}, {},
{ {
left: null, left: null,
...@@ -787,8 +734,8 @@ describe('DiffsStoreActions', () => { ...@@ -787,8 +734,8 @@ describe('DiffsStoreActions', () => {
}, },
}, },
); );
scrollToLineIfNeededParallel({}, lineMock); diffActions.scrollToLineIfNeededParallel({}, lineMock);
scrollToLineIfNeededParallel( diffActions.scrollToLineIfNeededParallel(
{}, {},
{ {
left: null, left: null,
...@@ -829,7 +776,7 @@ describe('DiffsStoreActions', () => { ...@@ -829,7 +776,7 @@ describe('DiffsStoreActions', () => {
} }
}); });
return saveDiffDiscussion({ state, dispatch }, { note, formData }).then(() => { return diffActions.saveDiffDiscussion({ state, dispatch }, { note, formData }).then(() => {
expect(dispatch).toHaveBeenCalledTimes(5); expect(dispatch).toHaveBeenCalledTimes(5);
expect(dispatch).toHaveBeenNthCalledWith(1, 'saveNote', expect.any(Object), { expect(dispatch).toHaveBeenNthCalledWith(1, 'saveNote', expect.any(Object), {
root: true, root: true,
...@@ -847,7 +794,7 @@ describe('DiffsStoreActions', () => { ...@@ -847,7 +794,7 @@ describe('DiffsStoreActions', () => {
describe('toggleTreeOpen', () => { describe('toggleTreeOpen', () => {
it('commits TOGGLE_FOLDER_OPEN', () => { it('commits TOGGLE_FOLDER_OPEN', () => {
return testAction( return testAction(
toggleTreeOpen, diffActions.toggleTreeOpen,
'path', 'path',
{}, {},
[{ type: types.TOGGLE_FOLDER_OPEN, payload: 'path' }], [{ type: types.TOGGLE_FOLDER_OPEN, payload: 'path' }],
...@@ -873,7 +820,7 @@ describe('DiffsStoreActions', () => { ...@@ -873,7 +820,7 @@ describe('DiffsStoreActions', () => {
}, },
}; };
scrollToFile({ state, commit, getters }, { path: 'path' }); diffActions.scrollToFile({ state, commit, getters }, { path: 'path' });
expect(document.location.hash).toBe('#test'); expect(document.location.hash).toBe('#test');
}); });
...@@ -887,7 +834,7 @@ describe('DiffsStoreActions', () => { ...@@ -887,7 +834,7 @@ describe('DiffsStoreActions', () => {
}, },
}; };
scrollToFile({ state, commit, getters }, { path: 'path' }); diffActions.scrollToFile({ state, commit, getters }, { path: 'path' });
expect(commit).toHaveBeenCalledWith(types.SET_CURRENT_DIFF_FILE, 'test'); expect(commit).toHaveBeenCalledWith(types.SET_CURRENT_DIFF_FILE, 'test');
}); });
...@@ -896,7 +843,7 @@ describe('DiffsStoreActions', () => { ...@@ -896,7 +843,7 @@ describe('DiffsStoreActions', () => {
describe('setShowTreeList', () => { describe('setShowTreeList', () => {
it('commits toggle', () => { it('commits toggle', () => {
return testAction( return testAction(
setShowTreeList, diffActions.setShowTreeList,
{ showTreeList: true }, { showTreeList: true },
{}, {},
[{ type: types.SET_SHOW_TREE_LIST, payload: true }], [{ type: types.SET_SHOW_TREE_LIST, payload: true }],
...@@ -907,7 +854,7 @@ describe('DiffsStoreActions', () => { ...@@ -907,7 +854,7 @@ describe('DiffsStoreActions', () => {
it('updates localStorage', () => { it('updates localStorage', () => {
jest.spyOn(localStorage, 'setItem').mockImplementation(() => {}); jest.spyOn(localStorage, 'setItem').mockImplementation(() => {});
setShowTreeList({ commit() {} }, { showTreeList: true }); diffActions.setShowTreeList({ commit() {} }, { showTreeList: true });
expect(localStorage.setItem).toHaveBeenCalledWith('mr_tree_show', true); expect(localStorage.setItem).toHaveBeenCalledWith('mr_tree_show', true);
}); });
...@@ -915,7 +862,7 @@ describe('DiffsStoreActions', () => { ...@@ -915,7 +862,7 @@ describe('DiffsStoreActions', () => {
it('does not update localStorage', () => { it('does not update localStorage', () => {
jest.spyOn(localStorage, 'setItem').mockImplementation(() => {}); jest.spyOn(localStorage, 'setItem').mockImplementation(() => {});
setShowTreeList({ commit() {} }, { showTreeList: true, saving: false }); diffActions.setShowTreeList({ commit() {} }, { showTreeList: true, saving: false });
expect(localStorage.setItem).not.toHaveBeenCalled(); expect(localStorage.setItem).not.toHaveBeenCalled();
}); });
...@@ -962,7 +909,7 @@ describe('DiffsStoreActions', () => { ...@@ -962,7 +909,7 @@ describe('DiffsStoreActions', () => {
it('renders and expands file for the given discussion id', () => { it('renders and expands file for the given discussion id', () => {
const localState = state({ collapsed: true, renderIt: false }); const localState = state({ collapsed: true, renderIt: false });
renderFileForDiscussionId({ rootState, state: localState, commit }, '123'); diffActions.renderFileForDiscussionId({ rootState, state: localState, commit }, '123');
expect(commit).toHaveBeenCalledWith('RENDER_FILE', localState.diffFiles[0]); expect(commit).toHaveBeenCalledWith('RENDER_FILE', localState.diffFiles[0]);
expect($emit).toHaveBeenCalledTimes(1); expect($emit).toHaveBeenCalledTimes(1);
...@@ -972,7 +919,7 @@ describe('DiffsStoreActions', () => { ...@@ -972,7 +919,7 @@ describe('DiffsStoreActions', () => {
it('jumps to discussion on already rendered and expanded file', () => { it('jumps to discussion on already rendered and expanded file', () => {
const localState = state({ collapsed: false, renderIt: true }); const localState = state({ collapsed: false, renderIt: true });
renderFileForDiscussionId({ rootState, state: localState, commit }, '123'); diffActions.renderFileForDiscussionId({ rootState, state: localState, commit }, '123');
expect(commit).not.toHaveBeenCalled(); expect(commit).not.toHaveBeenCalled();
expect($emit).toHaveBeenCalledTimes(1); expect($emit).toHaveBeenCalledTimes(1);
...@@ -983,7 +930,7 @@ describe('DiffsStoreActions', () => { ...@@ -983,7 +930,7 @@ describe('DiffsStoreActions', () => {
describe('setRenderTreeList', () => { describe('setRenderTreeList', () => {
it('commits SET_RENDER_TREE_LIST', () => { it('commits SET_RENDER_TREE_LIST', () => {
return testAction( return testAction(
setRenderTreeList, diffActions.setRenderTreeList,
{ renderTreeList: true }, { renderTreeList: true },
{}, {},
[{ type: types.SET_RENDER_TREE_LIST, payload: true }], [{ type: types.SET_RENDER_TREE_LIST, payload: true }],
...@@ -992,7 +939,7 @@ describe('DiffsStoreActions', () => { ...@@ -992,7 +939,7 @@ describe('DiffsStoreActions', () => {
}); });
it('sets localStorage', () => { it('sets localStorage', () => {
setRenderTreeList({ commit() {} }, { renderTreeList: true }); diffActions.setRenderTreeList({ commit() {} }, { renderTreeList: true });
expect(localStorage.setItem).toHaveBeenCalledWith('mr_diff_tree_list', true); expect(localStorage.setItem).toHaveBeenCalledWith('mr_diff_tree_list', true);
}); });
...@@ -1001,11 +948,9 @@ describe('DiffsStoreActions', () => { ...@@ -1001,11 +948,9 @@ describe('DiffsStoreActions', () => {
describe('setShowWhitespace', () => { describe('setShowWhitespace', () => {
const endpointUpdateUser = 'user/prefs'; const endpointUpdateUser = 'user/prefs';
let putSpy; let putSpy;
let mock;
let gon; let gon;
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
putSpy = jest.spyOn(axios, 'put'); putSpy = jest.spyOn(axios, 'put');
gon = window.gon; gon = window.gon;
...@@ -1014,13 +959,12 @@ describe('DiffsStoreActions', () => { ...@@ -1014,13 +959,12 @@ describe('DiffsStoreActions', () => {
}); });
afterEach(() => { afterEach(() => {
mock.restore();
window.gon = gon; window.gon = gon;
}); });
it('commits SET_SHOW_WHITESPACE', () => { it('commits SET_SHOW_WHITESPACE', () => {
return testAction( return testAction(
setShowWhitespace, diffActions.setShowWhitespace,
{ showWhitespace: true, updateDatabase: false }, { showWhitespace: true, updateDatabase: false },
{}, {},
[{ type: types.SET_SHOW_WHITESPACE, payload: true }], [{ type: types.SET_SHOW_WHITESPACE, payload: true }],
...@@ -1031,7 +975,7 @@ describe('DiffsStoreActions', () => { ...@@ -1031,7 +975,7 @@ describe('DiffsStoreActions', () => {
it('saves to the database when the user is logged in', async () => { it('saves to the database when the user is logged in', async () => {
window.gon = { current_user_id: 12345 }; window.gon = { current_user_id: 12345 };
await setShowWhitespace( await diffActions.setShowWhitespace(
{ state: { endpointUpdateUser }, commit() {} }, { state: { endpointUpdateUser }, commit() {} },
{ showWhitespace: true, updateDatabase: true }, { showWhitespace: true, updateDatabase: true },
); );
...@@ -1042,7 +986,7 @@ describe('DiffsStoreActions', () => { ...@@ -1042,7 +986,7 @@ describe('DiffsStoreActions', () => {
it('does not try to save to the API if the user is not logged in', async () => { it('does not try to save to the API if the user is not logged in', async () => {
window.gon = {}; window.gon = {};
await setShowWhitespace( await diffActions.setShowWhitespace(
{ state: { endpointUpdateUser }, commit() {} }, { state: { endpointUpdateUser }, commit() {} },
{ showWhitespace: true, updateDatabase: true }, { showWhitespace: true, updateDatabase: true },
); );
...@@ -1051,7 +995,7 @@ describe('DiffsStoreActions', () => { ...@@ -1051,7 +995,7 @@ describe('DiffsStoreActions', () => {
}); });
it('emits eventHub event', async () => { it('emits eventHub event', async () => {
await setShowWhitespace( await diffActions.setShowWhitespace(
{ state: {}, commit() {} }, { state: {}, commit() {} },
{ showWhitespace: true, updateDatabase: false }, { showWhitespace: true, updateDatabase: false },
); );
...@@ -1063,7 +1007,7 @@ describe('DiffsStoreActions', () => { ...@@ -1063,7 +1007,7 @@ describe('DiffsStoreActions', () => {
describe('setRenderIt', () => { describe('setRenderIt', () => {
it('commits RENDER_FILE', () => { it('commits RENDER_FILE', () => {
return testAction( return testAction(
setRenderIt, diffActions.setRenderIt,
'file', 'file',
{}, {},
[{ type: types.RENDER_FILE, payload: 'file' }], [{ type: types.RENDER_FILE, payload: 'file' }],
...@@ -1075,7 +1019,7 @@ describe('DiffsStoreActions', () => { ...@@ -1075,7 +1019,7 @@ describe('DiffsStoreActions', () => {
describe('receiveFullDiffError', () => { describe('receiveFullDiffError', () => {
it('updates state with the file that did not load', () => { it('updates state with the file that did not load', () => {
return testAction( return testAction(
receiveFullDiffError, diffActions.receiveFullDiffError,
'file', 'file',
{}, {},
[{ type: types.RECEIVE_FULL_DIFF_ERROR, payload: 'file' }], [{ type: types.RECEIVE_FULL_DIFF_ERROR, payload: 'file' }],
...@@ -1085,16 +1029,6 @@ describe('DiffsStoreActions', () => { ...@@ -1085,16 +1029,6 @@ describe('DiffsStoreActions', () => {
}); });
describe('fetchFullDiff', () => { describe('fetchFullDiff', () => {
let mock;
beforeEach(() => {
mock = new MockAdapter(axios);
});
afterEach(() => {
mock.restore();
});
describe('success', () => { describe('success', () => {
beforeEach(() => { beforeEach(() => {
mock.onGet(`${TEST_HOST}/context`).replyOnce(200, ['test']); mock.onGet(`${TEST_HOST}/context`).replyOnce(200, ['test']);
...@@ -1107,7 +1041,7 @@ describe('DiffsStoreActions', () => { ...@@ -1107,7 +1041,7 @@ describe('DiffsStoreActions', () => {
file_hash: 'test', file_hash: 'test',
}; };
return testAction( return testAction(
fetchFullDiff, diffActions.fetchFullDiff,
file, file,
null, null,
[{ type: types.RECEIVE_FULL_DIFF_SUCCESS, payload: { filePath: 'test' } }], [{ type: types.RECEIVE_FULL_DIFF_SUCCESS, payload: { filePath: 'test' } }],
...@@ -1123,7 +1057,7 @@ describe('DiffsStoreActions', () => { ...@@ -1123,7 +1057,7 @@ describe('DiffsStoreActions', () => {
it('dispatches receiveFullDiffError', () => { it('dispatches receiveFullDiffError', () => {
return testAction( return testAction(
fetchFullDiff, diffActions.fetchFullDiff,
{ context_lines_path: `${TEST_HOST}/context`, file_path: 'test', file_hash: 'test' }, { context_lines_path: `${TEST_HOST}/context`, file_path: 'test', file_hash: 'test' },
null, null,
[], [],
...@@ -1144,7 +1078,7 @@ describe('DiffsStoreActions', () => { ...@@ -1144,7 +1078,7 @@ describe('DiffsStoreActions', () => {
it('dispatches fetchFullDiff when file is not expanded', () => { it('dispatches fetchFullDiff when file is not expanded', () => {
return testAction( return testAction(
toggleFullDiff, diffActions.toggleFullDiff,
'test', 'test',
state, state,
[{ type: types.REQUEST_FULL_DIFF, payload: 'test' }], [{ type: types.REQUEST_FULL_DIFF, payload: 'test' }],
...@@ -1170,16 +1104,13 @@ describe('DiffsStoreActions', () => { ...@@ -1170,16 +1104,13 @@ describe('DiffsStoreActions', () => {
}; };
const testData = [{ rich_text: 'test' }, { rich_text: 'file2' }]; const testData = [{ rich_text: 'test' }, { rich_text: 'file2' }];
let renamedFile; let renamedFile;
let mock;
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
jest.spyOn(utils, 'prepareLineForRenamedFile').mockImplementation(() => preparedLine); jest.spyOn(utils, 'prepareLineForRenamedFile').mockImplementation(() => preparedLine);
}); });
afterEach(() => { afterEach(() => {
renamedFile = null; renamedFile = null;
mock.restore();
}); });
describe('success', () => { describe('success', () => {
...@@ -1196,7 +1127,7 @@ describe('DiffsStoreActions', () => { ...@@ -1196,7 +1127,7 @@ describe('DiffsStoreActions', () => {
'performs the correct mutations and starts a render queue for view type $diffViewType', 'performs the correct mutations and starts a render queue for view type $diffViewType',
({ diffViewType }) => { ({ diffViewType }) => {
return testAction( return testAction(
switchToFullDiffFromRenamedFile, diffActions.switchToFullDiffFromRenamedFile,
{ diffFile: renamedFile }, { diffFile: renamedFile },
{ diffViewType }, { diffViewType },
[ [
...@@ -1219,7 +1150,7 @@ describe('DiffsStoreActions', () => { ...@@ -1219,7 +1150,7 @@ describe('DiffsStoreActions', () => {
describe('setFileUserCollapsed', () => { describe('setFileUserCollapsed', () => {
it('commits SET_FILE_COLLAPSED', () => { it('commits SET_FILE_COLLAPSED', () => {
return testAction( return testAction(
setFileCollapsedByUser, diffActions.setFileCollapsedByUser,
{ filePath: 'test', collapsed: true }, { filePath: 'test', collapsed: true },
null, null,
[ [
...@@ -1244,7 +1175,7 @@ describe('DiffsStoreActions', () => { ...@@ -1244,7 +1175,7 @@ describe('DiffsStoreActions', () => {
utils.convertExpandLines.mockImplementation(() => ['test']); utils.convertExpandLines.mockImplementation(() => ['test']);
return testAction( return testAction(
setExpandedDiffLines, diffActions.setExpandedDiffLines,
{ file: { file_path: 'path' }, data: [] }, { file: { file_path: 'path' }, data: [] },
{ diffViewType: 'inline' }, { diffViewType: 'inline' },
[ [
...@@ -1262,7 +1193,7 @@ describe('DiffsStoreActions', () => { ...@@ -1262,7 +1193,7 @@ describe('DiffsStoreActions', () => {
utils.convertExpandLines.mockReturnValue(lines); utils.convertExpandLines.mockReturnValue(lines);
return testAction( return testAction(
setExpandedDiffLines, diffActions.setExpandedDiffLines,
{ file: { file_path: 'path' }, data: [] }, { file: { file_path: 'path' }, data: [] },
{ diffViewType: 'inline' }, { diffViewType: 'inline' },
[ [
...@@ -1285,13 +1216,12 @@ describe('DiffsStoreActions', () => { ...@@ -1285,13 +1216,12 @@ describe('DiffsStoreActions', () => {
describe('setSuggestPopoverDismissed', () => { describe('setSuggestPopoverDismissed', () => {
it('commits SET_SHOW_SUGGEST_POPOVER', async () => { it('commits SET_SHOW_SUGGEST_POPOVER', async () => {
const state = { dismissEndpoint: `${TEST_HOST}/-/user_callouts` }; const state = { dismissEndpoint: `${TEST_HOST}/-/user_callouts` };
const mock = new MockAdapter(axios);
mock.onPost(state.dismissEndpoint).reply(200, {}); mock.onPost(state.dismissEndpoint).reply(200, {});
jest.spyOn(axios, 'post'); jest.spyOn(axios, 'post');
await testAction( await testAction(
setSuggestPopoverDismissed, diffActions.setSuggestPopoverDismissed,
null, null,
state, state,
[{ type: types.SET_SHOW_SUGGEST_POPOVER }], [{ type: types.SET_SHOW_SUGGEST_POPOVER }],
...@@ -1306,7 +1236,7 @@ describe('DiffsStoreActions', () => { ...@@ -1306,7 +1236,7 @@ describe('DiffsStoreActions', () => {
describe('changeCurrentCommit', () => { describe('changeCurrentCommit', () => {
it('commits the new commit information and re-requests the diff metadata for the commit', () => { it('commits the new commit information and re-requests the diff metadata for the commit', () => {
return testAction( return testAction(
changeCurrentCommit, diffActions.changeCurrentCommit,
{ commitId: 'NEW' }, { commitId: 'NEW' },
{ {
commit: { commit: {
...@@ -1344,7 +1274,7 @@ describe('DiffsStoreActions', () => { ...@@ -1344,7 +1274,7 @@ describe('DiffsStoreActions', () => {
({ commitId, commit, msg }) => { ({ commitId, commit, msg }) => {
const err = new Error(msg); const err = new Error(msg);
const actionReturn = testAction( const actionReturn = testAction(
changeCurrentCommit, diffActions.changeCurrentCommit,
{ commitId }, { commitId },
{ {
endpoint: 'URL/OLD', endpoint: 'URL/OLD',
...@@ -1370,7 +1300,7 @@ describe('DiffsStoreActions', () => { ...@@ -1370,7 +1300,7 @@ describe('DiffsStoreActions', () => {
'for the direction "$direction", dispatches the action to move to the SHA "$expected"', 'for the direction "$direction", dispatches the action to move to the SHA "$expected"',
({ direction, expected, currentCommit }) => { ({ direction, expected, currentCommit }) => {
return testAction( return testAction(
moveToNeighboringCommit, diffActions.moveToNeighboringCommit,
{ direction }, { direction },
{ commit: currentCommit }, { commit: currentCommit },
[], [],
...@@ -1391,7 +1321,7 @@ describe('DiffsStoreActions', () => { ...@@ -1391,7 +1321,7 @@ describe('DiffsStoreActions', () => {
'given `{ "isloading": $diffsAreLoading, "commit": $currentCommit }` in state, no actions are dispatched', 'given `{ "isloading": $diffsAreLoading, "commit": $currentCommit }` in state, no actions are dispatched',
({ direction, diffsAreLoading, currentCommit }) => { ({ direction, diffsAreLoading, currentCommit }) => {
return testAction( return testAction(
moveToNeighboringCommit, diffActions.moveToNeighboringCommit,
{ direction }, { direction },
{ commit: currentCommit, isLoading: diffsAreLoading }, { commit: currentCommit, isLoading: diffsAreLoading },
[], [],
...@@ -1410,7 +1340,7 @@ describe('DiffsStoreActions', () => { ...@@ -1410,7 +1340,7 @@ describe('DiffsStoreActions', () => {
notesById: { 1: { discussion_id: '2' } }, notesById: { 1: { discussion_id: '2' } },
}; };
setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); diffActions.setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1');
expect(commit).toHaveBeenCalledWith(types.SET_CURRENT_DIFF_FILE, '123'); expect(commit).toHaveBeenCalledWith(types.SET_CURRENT_DIFF_FILE, '123');
}); });
...@@ -1423,7 +1353,7 @@ describe('DiffsStoreActions', () => { ...@@ -1423,7 +1353,7 @@ describe('DiffsStoreActions', () => {
notesById: { 1: { discussion_id: '2' } }, notesById: { 1: { discussion_id: '2' } },
}; };
setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); diffActions.setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1');
expect(commit).not.toHaveBeenCalled(); expect(commit).not.toHaveBeenCalled();
}); });
...@@ -1436,7 +1366,7 @@ describe('DiffsStoreActions', () => { ...@@ -1436,7 +1366,7 @@ describe('DiffsStoreActions', () => {
notesById: { 1: { discussion_id: '2' } }, notesById: { 1: { discussion_id: '2' } },
}; };
setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); diffActions.setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1');
expect(commit).not.toHaveBeenCalled(); expect(commit).not.toHaveBeenCalled();
}); });
...@@ -1445,7 +1375,7 @@ describe('DiffsStoreActions', () => { ...@@ -1445,7 +1375,7 @@ describe('DiffsStoreActions', () => {
describe('navigateToDiffFileIndex', () => { describe('navigateToDiffFileIndex', () => {
it('commits SET_CURRENT_DIFF_FILE', () => { it('commits SET_CURRENT_DIFF_FILE', () => {
return testAction( return testAction(
navigateToDiffFileIndex, diffActions.navigateToDiffFileIndex,
0, 0,
{ diffFiles: [{ file_hash: '123' }] }, { diffFiles: [{ file_hash: '123' }] },
[{ type: types.SET_CURRENT_DIFF_FILE, payload: '123' }], [{ type: types.SET_CURRENT_DIFF_FILE, payload: '123' }],
...@@ -1457,19 +1387,13 @@ describe('DiffsStoreActions', () => { ...@@ -1457,19 +1387,13 @@ describe('DiffsStoreActions', () => {
describe('setFileByFile', () => { describe('setFileByFile', () => {
const updateUserEndpoint = 'user/prefs'; const updateUserEndpoint = 'user/prefs';
let putSpy; let putSpy;
let mock;
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
putSpy = jest.spyOn(axios, 'put'); putSpy = jest.spyOn(axios, 'put');
mock.onPut(updateUserEndpoint).reply(200, {}); mock.onPut(updateUserEndpoint).reply(200, {});
}); });
afterEach(() => {
mock.restore();
});
it.each` it.each`
value value
${true} ${true}
...@@ -1478,7 +1402,7 @@ describe('DiffsStoreActions', () => { ...@@ -1478,7 +1402,7 @@ describe('DiffsStoreActions', () => {
'commits SET_FILE_BY_FILE and persists the File-by-File user preference with the new value $value', 'commits SET_FILE_BY_FILE and persists the File-by-File user preference with the new value $value',
async ({ value }) => { async ({ value }) => {
await testAction( await testAction(
setFileByFile, diffActions.setFileByFile,
{ fileByFile: value }, { fileByFile: value },
{ {
viewDiffsFileByFile: null, viewDiffsFileByFile: null,
...@@ -1510,7 +1434,7 @@ describe('DiffsStoreActions', () => { ...@@ -1510,7 +1434,7 @@ describe('DiffsStoreActions', () => {
const commitSpy = jest.fn(); const commitSpy = jest.fn();
const getterSpy = jest.fn().mockReturnValue([]); const getterSpy = jest.fn().mockReturnValue([]);
reviewFile( diffActions.reviewFile(
{ {
commit: commitSpy, commit: commitSpy,
getters: { getters: {
......
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