Create links to load more lines in diffs

This commit is contained in:
René Pfeuffer
2020-05-27 12:52:30 +02:00
parent d09b254f00
commit 4093e734eb
3 changed files with 31 additions and 8 deletions

View File

@@ -86,6 +86,19 @@ class DiffResultToDiffResultDtoMapperTest {
.isEqualTo("/scm/api/v2/repositories/space/X/diff/123/parsed");
}
@Test
void shouldCreateLinkToLoadMoreLinesForFilesWithHunks() {
DiffResultDto dto = mapper.mapForRevision(REPOSITORY, createResult(), "123");
assertThat(dto.getFiles().get(0).getLinks().getLinkBy("lines"))
.isNotPresent();
assertThat(dto.getFiles().get(1).getLinks().getLinkBy("lines"))
.isPresent()
.get()
.extracting("href")
.isEqualTo("/scm/api/v2/repositories/space/X/content/123/B.ts?start={start}?end={end}");
}
@Test
void shouldCreateSelfLinkForIncoming() {
DiffResultDto dto = mapper.mapForIncoming(REPOSITORY, createResult(), "feature/some", "master");