stable

Clone or download

Read-only

refactor: Use FileLine and GroupOfLines stubs in unit tests

part of request #29602 Migrate pullrequest file-diffs to TypeScript This refactoring is needed to ease the writing of unit tests in the file diff feature. Moreover, it will be less work to do when we'll have to update the shape of these objects, since there stubs are build at one place. It also makes the tests easier to understand. Indeed, we have test cases with unmoved, added and removed lines and groups of lines, and it is confusing to have only offsets (new/old/unidiff) to tell them appart. -- No functional changes expected -- CI should be happy Change-Id: I76f692a8c7dc75c9f591fa79ca5ebd11c3f58b5b

Modified Files

Name
M plugins/pullrequest/scripts/pullrequests-app/src/app/code-collapse/collapsible-code-sections.test.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-code-placeholder-builder.test.js +30 −29 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-comment-placeholder-builder.test.js +36 −36 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-grouper.test.ts +24 −15 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-grouper.ts +1 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-line-mapper.test.js +59 −70 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-lines-state.test.js +38 −47 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-placeholder-positioner.test.js +4 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/types.ts +1 −0 Go to diff View file
A plugins/pullrequest/scripts/pullrequests-app/tests/stubs/FileLineStub.ts +42 −0 Go to diff View file
A plugins/pullrequest/scripts/pullrequests-app/tests/stubs/GroupOfLinesStub.ts +57 −0 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/tests/stubs/GroupSideBySideLinesStub.ts +13 −7 Go to diff View file