Skip to content

Commit 2ca7fc0

Browse files
committed
Cover the case where an accepted clamp hides another differing param
When isReducedPageSize() accepts a reduced page size, isUnexpectedSelfLink() re-compares the remaining parts rather than returning early, so a legitimate clamp can't mask a genuinely wrong page/sort. Nothing defended that: dropping the second urlPartsDiffer() call left all 22 tests green while silently swallowing the defect.
1 parent 62b0e95 commit 2ca7fc0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/app/core/data/dspace-rest-response-parsing.service.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ describe('DspaceRestResponseParsingService', () => {
146146
expect(console.warn).toHaveBeenCalledWith(MISMATCH);
147147
});
148148

149+
it('should warn when a reduced page size hides another param that differs', () => {
150+
const request = requestFor('https://rest.api/core/items/eba1c085/bundles?page=0&size=9999');
151+
service.callEnsureSelfLink(request, responseWithSelfLink(
152+
'https://rest.api/core/items/eba1c085/bundles?page=3&size=1000',
153+
{ number: 3, size: 1000, totalPages: 4, totalElements: 3200 }));
154+
155+
expect(console.warn).toHaveBeenCalledTimes(1);
156+
expect(console.warn).toHaveBeenCalledWith(MISMATCH);
157+
});
158+
149159
it('should warn when the self link claims an empty page', () => {
150160
const request = requestFor('https://rest.api/core/items/eba1c085/bundles?size=10');
151161
service.callEnsureSelfLink(request, responseWithSelfLink(

0 commit comments

Comments
 (0)