diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/frontend/diffs/store | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/frontend/diffs/store')
-rw-r--r-- | spec/frontend/diffs/store/actions_spec.js | 123 | ||||
-rw-r--r-- | spec/frontend/diffs/store/getters_spec.js | 33 | ||||
-rw-r--r-- | spec/frontend/diffs/store/getters_versions_dropdowns_spec.js | 10 | ||||
-rw-r--r-- | spec/frontend/diffs/store/mutations_spec.js | 17 | ||||
-rw-r--r-- | spec/frontend/diffs/store/utils_spec.js | 79 |
5 files changed, 207 insertions, 55 deletions
diff --git a/spec/frontend/diffs/store/actions_spec.js b/spec/frontend/diffs/store/actions_spec.js index fef7676e795..056ac23fcf7 100644 --- a/spec/frontend/diffs/store/actions_spec.js +++ b/spec/frontend/diffs/store/actions_spec.js @@ -2,7 +2,8 @@ import MockAdapter from 'axios-mock-adapter'; import Cookies from 'js-cookie'; import mockDiffFile from 'jest/diffs/mock_data/diff_file'; import { useLocalStorageSpy } from 'helpers/local_storage_helper'; -import { TEST_HOST } from 'jest/helpers/test_constants'; +import { TEST_HOST } from 'helpers/test_constants'; +import testAction from 'helpers/vuex_action_helper'; import { DIFF_VIEW_COOKIE_NAME, INLINE_DIFF_VIEW_TYPE, @@ -49,11 +50,11 @@ import { setCurrentDiffFileIdFromNote, navigateToDiffFileIndex, setFileByFile, + reviewFile, } from '~/diffs/store/actions'; import eventHub from '~/notes/event_hub'; import * as types from '~/diffs/store/mutation_types'; import axios from '~/lib/utils/axios_utils'; -import testAction from '../../helpers/vuex_action_helper'; import * as utils from '~/diffs/store/utils'; import * as commonUtils from '~/lib/utils/common_utils'; import { mergeUrlParams } from '~/lib/utils/url_utility'; @@ -77,22 +78,22 @@ describe('DiffsStoreActions', () => { jest.spyOn(commonUtils, 'scrollToElement').mockImplementation(() => null); jest.spyOn(utils, 'convertExpandLines').mockImplementation(() => null); jest.spyOn(utils, 'idleCallback').mockImplementation(() => null); - ['requestAnimationFrame', 'requestIdleCallback'].forEach(method => { - global[method] = cb => { + ['requestAnimationFrame', 'requestIdleCallback'].forEach((method) => { + global[method] = (cb) => { cb(); }; }); }); afterEach(() => { - ['requestAnimationFrame', 'requestIdleCallback'].forEach(method => { + ['requestAnimationFrame', 'requestIdleCallback'].forEach((method) => { global[method] = originalMethods[method]; }); createFlash.mockClear(); }); describe('setBaseConfig', () => { - it('should set given endpoint and project path', done => { + it('should set given endpoint and project path', (done) => { const endpoint = '/diffs/set/endpoint'; const endpointMetadata = '/diffs/set/endpoint/metadata'; const endpointBatch = '/diffs/set/endpoint/batch'; @@ -152,7 +153,7 @@ describe('DiffsStoreActions', () => { mock.restore(); }); - it('should fetch batch diff files', done => { + it('should fetch batch diff files', (done) => { const endpointBatch = '/fetch/diffs_batch'; const res1 = { diff_files: [{ file_hash: 'test' }], pagination: { next_page: 2 } }; const res2 = { diff_files: [{ file_hash: 'test2' }], pagination: {} }; @@ -240,7 +241,7 @@ describe('DiffsStoreActions', () => { mock.onGet(endpointMetadata).reply(200, diffMetadata); }); - it('should fetch diff meta information', done => { + it('should fetch diff meta information', (done) => { testAction( fetchDiffFilesMeta, {}, @@ -270,8 +271,8 @@ describe('DiffsStoreActions', () => { afterEach(() => mock.restore()); - it('should commit SET_COVERAGE_DATA with received response', done => { - const data = { files: { 'app.js': { '1': 0, '2': 1 } } }; + it('should commit SET_COVERAGE_DATA with received response', (done) => { + const data = { files: { 'app.js': { 1: 0, 2: 1 } } }; mock.onGet(endpointCoverage).reply(200, { data }); @@ -285,7 +286,7 @@ describe('DiffsStoreActions', () => { ); }); - it('should show flash on API error', done => { + it('should show flash on API error', (done) => { mock.onGet(endpointCoverage).reply(400); testAction(fetchCoverageFiles, {}, { endpointCoverage }, [], [], () => { @@ -310,7 +311,7 @@ describe('DiffsStoreActions', () => { window.location.hash = ''; }); - it('should merge discussions into diffs', done => { + it('should merge discussions into diffs', (done) => { window.location.hash = 'ABC_123'; const state = { @@ -404,7 +405,7 @@ describe('DiffsStoreActions', () => { ); }); - it('dispatches setCurrentDiffFileIdFromNote with note ID', done => { + it('dispatches setCurrentDiffFileIdFromNote with note ID', (done) => { window.location.hash = 'note_123'; testAction( @@ -419,7 +420,7 @@ describe('DiffsStoreActions', () => { }); describe('removeDiscussionsFromDiff', () => { - it('should remove discussions from diffs', done => { + it('should remove discussions from diffs', (done) => { const state = { diffFiles: [ { @@ -511,7 +512,7 @@ describe('DiffsStoreActions', () => { }); describe('setInlineDiffViewType', () => { - it('should set diff view type to inline and also set the cookie properly', done => { + it('should set diff view type to inline and also set the cookie properly', (done) => { testAction( setInlineDiffViewType, null, @@ -529,7 +530,7 @@ describe('DiffsStoreActions', () => { }); describe('setParallelDiffViewType', () => { - it('should set diff view type to parallel and also set the cookie properly', done => { + it('should set diff view type to parallel and also set the cookie properly', (done) => { testAction( setParallelDiffViewType, null, @@ -547,7 +548,7 @@ describe('DiffsStoreActions', () => { }); describe('showCommentForm', () => { - it('should call mutation to show comment form', done => { + it('should call mutation to show comment form', (done) => { const payload = { lineCode: 'lineCode', fileHash: 'hash' }; testAction( @@ -562,7 +563,7 @@ describe('DiffsStoreActions', () => { }); describe('cancelCommentForm', () => { - it('should call mutation to cancel comment form', done => { + it('should call mutation to cancel comment form', (done) => { const payload = { lineCode: 'lineCode', fileHash: 'hash' }; testAction( @@ -577,7 +578,7 @@ describe('DiffsStoreActions', () => { }); describe('loadMoreLines', () => { - it('should call mutation to show comment form', done => { + it('should call mutation to show comment form', (done) => { const endpoint = '/diffs/load/more/lines'; const params = { since: 6, to: 26 }; const lineNumbers = { oldLineNumber: 3, newLineNumber: 5 }; @@ -610,7 +611,7 @@ describe('DiffsStoreActions', () => { describe('loadCollapsedDiff', () => { const state = { showWhitespace: true }; - it('should fetch data and call mutation with response and the give parameter', done => { + it('should fetch data and call mutation with response and the give parameter', (done) => { const file = { hash: 123, load_collapsed_diff_url: '/load/collapsed/diff/url' }; const data = { hash: 123, parallelDiffLines: [{ lineCode: 1 }] }; const mock = new MockAdapter(axios); @@ -810,7 +811,7 @@ describe('DiffsStoreActions', () => { }); describe('saveDiffDiscussion', () => { - it('dispatches actions', done => { + it('dispatches actions', (done) => { const commitId = 'something'; const formData = { diffFile: { ...mockDiffFile }, @@ -822,7 +823,7 @@ describe('DiffsStoreActions', () => { id: commitId, }, }; - const dispatch = jest.fn(name => { + const dispatch = jest.fn((name) => { switch (name) { case 'saveNote': return Promise.resolve({ @@ -854,7 +855,7 @@ describe('DiffsStoreActions', () => { }); describe('toggleTreeOpen', () => { - it('commits TOGGLE_FOLDER_OPEN', done => { + it('commits TOGGLE_FOLDER_OPEN', (done) => { testAction( toggleTreeOpen, 'path', @@ -903,7 +904,7 @@ describe('DiffsStoreActions', () => { }); describe('setShowTreeList', () => { - it('commits toggle', done => { + it('commits toggle', (done) => { testAction( setShowTreeList, { showTreeList: true }, @@ -991,7 +992,7 @@ describe('DiffsStoreActions', () => { }); describe('setRenderTreeList', () => { - it('commits SET_RENDER_TREE_LIST', done => { + it('commits SET_RENDER_TREE_LIST', (done) => { testAction( setRenderTreeList, true, @@ -1014,7 +1015,7 @@ describe('DiffsStoreActions', () => { jest.spyOn(eventHub, '$emit').mockImplementation(); }); - it('commits SET_SHOW_WHITESPACE', done => { + it('commits SET_SHOW_WHITESPACE', (done) => { testAction( setShowWhitespace, { showWhitespace: true }, @@ -1057,13 +1058,13 @@ describe('DiffsStoreActions', () => { }); describe('setRenderIt', () => { - it('commits RENDER_FILE', done => { + it('commits RENDER_FILE', (done) => { testAction(setRenderIt, 'file', {}, [{ type: types.RENDER_FILE, payload: 'file' }], [], done); }); }); describe('receiveFullDiffError', () => { - it('updates state with the file that did not load', done => { + it('updates state with the file that did not load', (done) => { testAction( receiveFullDiffError, 'file', @@ -1091,7 +1092,7 @@ describe('DiffsStoreActions', () => { mock.onGet(`${TEST_HOST}/context`).replyOnce(200, ['test']); }); - it('commits the success and dispatches an action to expand the new lines', done => { + it('commits the success and dispatches an action to expand the new lines', (done) => { const file = { context_lines_path: `${TEST_HOST}/context`, file_path: 'test', @@ -1113,7 +1114,7 @@ describe('DiffsStoreActions', () => { mock.onGet(`${TEST_HOST}/context`).replyOnce(500); }); - it('dispatches receiveFullDiffError', done => { + it('dispatches receiveFullDiffError', (done) => { testAction( fetchFullDiff, { context_lines_path: `${TEST_HOST}/context`, file_path: 'test', file_hash: 'test' }, @@ -1135,7 +1136,7 @@ describe('DiffsStoreActions', () => { }; }); - it('dispatches fetchFullDiff when file is not expanded', done => { + it('dispatches fetchFullDiff when file is not expanded', (done) => { testAction( toggleFullDiff, 'test', @@ -1211,7 +1212,7 @@ describe('DiffsStoreActions', () => { }); describe('setFileUserCollapsed', () => { - it('commits SET_FILE_COLLAPSED', done => { + it('commits SET_FILE_COLLAPSED', (done) => { testAction( setFileCollapsedByUser, { filePath: 'test', collapsed: true }, @@ -1230,12 +1231,12 @@ describe('DiffsStoreActions', () => { describe('setExpandedDiffLines', () => { beforeEach(() => { - utils.idleCallback.mockImplementation(cb => { + utils.idleCallback.mockImplementation((cb) => { cb({ timeRemaining: () => 50 }); }); }); - it('commits SET_CURRENT_VIEW_DIFF_FILE_LINES when lines less than MAX_RENDERING_DIFF_LINES', done => { + it('commits SET_CURRENT_VIEW_DIFF_FILE_LINES when lines less than MAX_RENDERING_DIFF_LINES', (done) => { utils.convertExpandLines.mockImplementation(() => ['test']); testAction( @@ -1253,7 +1254,7 @@ describe('DiffsStoreActions', () => { ); }); - it('commits ADD_CURRENT_VIEW_DIFF_FILE_LINES when lines more than MAX_RENDERING_DIFF_LINES', done => { + it('commits ADD_CURRENT_VIEW_DIFF_FILE_LINES when lines more than MAX_RENDERING_DIFF_LINES', (done) => { const lines = new Array(501).fill().map((_, i) => `line-${i}`); utils.convertExpandLines.mockReturnValue(lines); @@ -1280,7 +1281,7 @@ describe('DiffsStoreActions', () => { }); describe('setSuggestPopoverDismissed', () => { - it('commits SET_SHOW_SUGGEST_POPOVER', done => { + it('commits SET_SHOW_SUGGEST_POPOVER', (done) => { const state = { dismissEndpoint: `${TEST_HOST}/-/user_callouts` }; const mock = new MockAdapter(axios); mock.onPost(state.dismissEndpoint).reply(200, {}); @@ -1409,7 +1410,7 @@ describe('DiffsStoreActions', () => { const state = { diffFiles: [{ file_hash: '123' }] }; const rootGetters = { getDiscussion: () => ({ diff_file: { file_hash: '123' } }), - notesById: { '1': { discussion_id: '2' } }, + notesById: { 1: { discussion_id: '2' } }, }; setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); @@ -1422,7 +1423,7 @@ describe('DiffsStoreActions', () => { const state = { diffFiles: [{ file_hash: '123' }] }; const rootGetters = { getDiscussion: () => ({ id: '1' }), - notesById: { '1': { discussion_id: '2' } }, + notesById: { 1: { discussion_id: '2' } }, }; setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); @@ -1435,7 +1436,7 @@ describe('DiffsStoreActions', () => { const state = { diffFiles: [{ file_hash: '123' }] }; const rootGetters = { getDiscussion: () => ({ diff_file: { file_hash: '124' } }), - notesById: { '1': { discussion_id: '2' } }, + notesById: { 1: { discussion_id: '2' } }, }; setCurrentDiffFileIdFromNote({ commit, state, rootGetters }, '1'); @@ -1445,7 +1446,7 @@ describe('DiffsStoreActions', () => { }); describe('navigateToDiffFileIndex', () => { - it('commits VIEW_DIFF_FILE', done => { + it('commits VIEW_DIFF_FILE', (done) => { testAction( navigateToDiffFileIndex, 0, @@ -1472,4 +1473,46 @@ describe('DiffsStoreActions', () => { ); }); }); + + describe('reviewFile', () => { + const file = { + id: '123', + file_identifier_hash: 'abc', + load_collapsed_diff_url: 'gitlab-org/gitlab-test/-/merge_requests/1/diffs', + }; + it.each` + reviews | diffFile | reviewed + ${{ abc: ['123'] }} | ${file} | ${true} + ${{}} | ${file} | ${false} + `( + 'sets reviews ($reviews) to localStorage and state for file $file if it is marked reviewed=$reviewed', + ({ reviews, diffFile, reviewed }) => { + const commitSpy = jest.fn(); + const getterSpy = jest.fn().mockReturnValue([]); + + reviewFile( + { + commit: commitSpy, + getters: { + fileReviews: getterSpy, + }, + state: { + mrReviews: { abc: ['123'] }, + }, + }, + { + file: diffFile, + reviewed, + }, + ); + + expect(localStorage.setItem).toHaveBeenCalledTimes(1); + expect(localStorage.setItem).toHaveBeenCalledWith( + 'gitlab-org/gitlab-test/-/merge_requests/1-file-reviews', + JSON.stringify(reviews), + ); + expect(commitSpy).toHaveBeenCalledWith(types.SET_MR_FILE_REVIEWS, reviews); + }, + ); + }); }); diff --git a/spec/frontend/diffs/store/getters_spec.js b/spec/frontend/diffs/store/getters_spec.js index 7e936c561fc..4d7f861ac22 100644 --- a/spec/frontend/diffs/store/getters_spec.js +++ b/spec/frontend/diffs/store/getters_spec.js @@ -251,9 +251,12 @@ describe('Diffs Module Getters', () => { discussionMock.diff_file.file_hash = diffFileMock.file_hash; expect( - getters.getDiffFileDiscussions(localState, {}, {}, { discussions: [discussionMock] })( - diffFileMock, - ).length, + getters.getDiffFileDiscussions( + localState, + {}, + {}, + { discussions: [discussionMock] }, + )(diffFileMock).length, ).toEqual(1); }); @@ -345,7 +348,7 @@ describe('Diffs Module Getters', () => { describe('fileLineCoverage', () => { beforeEach(() => { - Object.assign(localState.coverageFiles, { files: { 'app.js': { '1': 0, '2': 5 } } }); + Object.assign(localState.coverageFiles, { files: { 'app.js': { 1: 0, 2: 5 } } }); }); it('returns empty object when no coverage data is available', () => { @@ -372,4 +375,26 @@ describe('Diffs Module Getters', () => { }); }); }); + + describe('fileReviews', () => { + const file1 = { id: '123', file_identifier_hash: 'abc' }; + const file2 = { id: '098', file_identifier_hash: 'abc' }; + + it.each` + reviews | files | fileReviews + ${{}} | ${[file1, file2]} | ${[false, false]} + ${{ abc: ['123'] }} | ${[file1, file2]} | ${[true, false]} + ${{ abc: ['098'] }} | ${[file1, file2]} | ${[false, true]} + ${{ def: ['123'] }} | ${[file1, file2]} | ${[false, false]} + ${{ abc: ['123'], def: ['098'] }} | ${[]} | ${[]} + `( + 'returns $fileReviews based on the diff files in state and the existing reviews $reviews', + ({ reviews, files, fileReviews }) => { + localState.diffFiles = files; + localState.mrReviews = reviews; + + expect(getters.fileReviews(localState)).toStrictEqual(fileReviews); + }, + ); + }); }); diff --git a/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js b/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js index 0343ef75732..f7954515422 100644 --- a/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js +++ b/spec/frontend/diffs/store/getters_versions_dropdowns_spec.js @@ -49,7 +49,7 @@ describe('Compare diff version dropdowns', () => { let expectedHeadVersion; const originalLocation = window.location; - const setupTest = includeDiffHeadParam => { + const setupTest = (includeDiffHeadParam) => { const diffHeadParam = includeDiffHeadParam ? '?diff_head=true' : ''; Object.defineProperty(window, 'location', { @@ -81,7 +81,7 @@ describe('Compare diff version dropdowns', () => { }; }; - const assertVersions = targetVersions => { + const assertVersions = (targetVersions) => { // base and head should be the last two versions in that order const targetBaseVersion = targetVersions[targetVersions.length - 2]; const targetHeadVersion = targetVersions[targetVersions.length - 1]; @@ -136,6 +136,7 @@ describe('Compare diff version dropdowns', () => { ...firstDiff, href: firstDiff.version_path, commitsText: `${firstDiff.commits_count} commits,`, + isLatestVersion: true, versionName: 'latest version', selected: true, }; @@ -144,6 +145,9 @@ describe('Compare diff version dropdowns', () => { selectedSourceIndex: expectedShape.version_index, }); expect(sourceVersions[0]).toEqual(expectedShape); - expect(sourceVersions[1].selected).toBe(false); + expect(sourceVersions[1]).toMatchObject({ + selected: false, + isLatestVersion: false, + }); }); }); diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js index 13e7cad835d..2c342d8e2a5 100644 --- a/spec/frontend/diffs/store/mutations_spec.js +++ b/spec/frontend/diffs/store/mutations_spec.js @@ -105,7 +105,7 @@ describe('DiffsStoreMutations', () => { describe('SET_COVERAGE_DATA', () => { it('should set coverage data properly', () => { const state = { coverageFiles: {} }; - const coverage = { 'app.js': { '1': 0, '2': 1 } }; + const coverage = { 'app.js': { 1: 0, 2: 1 } }; mutations[types.SET_COVERAGE_DATA](state, coverage); @@ -906,4 +906,19 @@ describe('DiffsStoreMutations', () => { expect(state.viewDiffsFileByFile).toBe(value); }); }); + + describe('SET_MR_FILE_REVIEWS', () => { + it.each` + newReviews | oldReviews + ${{ abc: ['123'] }} | ${{}} + ${{ abc: [] }} | ${{ abc: ['123'] }} + ${{}} | ${{ abc: ['123'] }} + `('sets mrReviews to $newReviews', ({ newReviews, oldReviews }) => { + const state = { mrReviews: oldReviews }; + + mutations[types.SET_MR_FILE_REVIEWS](state, newReviews); + + expect(state.mrReviews).toStrictEqual(newReviews); + }); + }); }); diff --git a/spec/frontend/diffs/store/utils_spec.js b/spec/frontend/diffs/store/utils_spec.js index 7ee97224707..a19e5e91677 100644 --- a/spec/frontend/diffs/store/utils_spec.js +++ b/spec/frontend/diffs/store/utils_spec.js @@ -481,7 +481,7 @@ describe('DiffsStoreUtils', () => { }); it('adds the `.brokenSymlink` property to each diff file', () => { - preparedDiff.diff_files.forEach(file => { + preparedDiff.diff_files.forEach((file) => { expect(file).toEqual(expect.objectContaining({ brokenSymlink: false })); }); }); @@ -492,9 +492,9 @@ describe('DiffsStoreUtils', () => { ...splitInlineDiff.diff_files, ...splitParallelDiff.diff_files, ...completedDiff.diff_files, - ].flatMap(file => [...file[INLINE_DIFF_LINES_KEY]]); + ].flatMap((file) => [...file[INLINE_DIFF_LINES_KEY]]); - lines.forEach(line => { + lines.forEach((line) => { expect(line.commentsDisabled).toBe(false); }); }); @@ -560,7 +560,7 @@ describe('DiffsStoreUtils', () => { }); it('adds the `.brokenSymlink` property to each meta diff file', () => { - preparedDiffFiles.forEach(file => { + preparedDiffFiles.forEach((file) => { expect(file).toMatchObject({ brokenSymlink: false }); }); }); @@ -1119,22 +1119,87 @@ describe('DiffsStoreUtils', () => { }); }); + describe('isConflictMarker', () => { + it.each` + type | expected + ${'conflict_marker_our'} | ${true} + ${'conflict_marker_their'} | ${true} + ${'conflict_their'} | ${false} + ${'conflict_our'} | ${false} + `('returns $expected when type is $type', ({ type, expected }) => { + expect(utils.isConflictMarker({ type })).toBe(expected); + }); + }); + + describe('isConflictOur', () => { + it.each` + type | expected + ${'conflict_marker_our'} | ${false} + ${'conflict_marker_their'} | ${false} + ${'conflict_their'} | ${false} + ${'conflict_our'} | ${true} + `('returns $expected when type is $type', ({ type, expected }) => { + expect(utils.isConflictOur({ type })).toBe(expected); + }); + }); + + describe('isConflictTheir', () => { + it.each` + type | expected + ${'conflict_marker_our'} | ${false} + ${'conflict_marker_their'} | ${false} + ${'conflict_their'} | ${true} + ${'conflict_our'} | ${false} + `('returns $expected when type is $type', ({ type, expected }) => { + expect(utils.isConflictTheir({ type })).toBe(expected); + }); + }); + describe('parallelizeDiffLines', () => { it('converts inline diff lines to parallel diff lines', () => { const file = getDiffFileMock(); - expect(utils.parallelizeDiffLines(file[INLINE_DIFF_LINES_KEY])).toEqual( + expect(utils.parallelizeDiffLines(file[INLINE_DIFF_LINES_KEY])).toMatchObject( file.parallel_diff_lines, ); }); + it('converts conflicted diffs line', () => { + const lines = [ + { type: 'new' }, + { type: 'conflict_marker_our' }, + { type: 'conflict_our' }, + { type: 'conflict_marker' }, + { type: 'conflict_their' }, + { type: 'conflict_marker_their' }, + ]; + + expect(utils.parallelizeDiffLines(lines)).toEqual([ + { + left: null, + right: { + chunk: 0, + type: 'new', + }, + }, + { + left: { chunk: 0, type: 'conflict_marker_our' }, + right: { chunk: 0, type: 'conflict_marker_their' }, + }, + { + left: { chunk: 0, type: 'conflict_our' }, + right: { chunk: 0, type: 'conflict_their' }, + }, + ]); + }); + it('converts inline diff lines', () => { const file = getDiffFileMock(); const files = utils.parallelizeDiffLines(file.highlighted_diff_lines, true); - expect(files[5].left).toEqual(file.parallel_diff_lines[5].left); + expect(files[5].left).toMatchObject(file.parallel_diff_lines[5].left); expect(files[5].right).toBeNull(); - expect(files[6].left).toEqual(file.parallel_diff_lines[5].right); + expect(files[6].left).toMatchObject(file.parallel_diff_lines[5].right); expect(files[6].right).toBeNull(); }); }); |