test: freeze server-filtered booking candidates

This commit is contained in:
2026-08-25 20:17:12 +08:00
parent ead9565a37
commit 5d2b6c22e6
3 changed files with 20 additions and 2 deletions
@@ -71,7 +71,10 @@ class PlatformOceanBookingControllerContractTest {
.contains("warehouseId", "channelCode", "containerType")
.contains("LinkCandidateResponse", "requiredQuantity", "allocatedQuantity", "remainingQuantity")
.contains("Capacity and max weight are derived display snapshots and never eligibility fields")
.contains("booking detail calls are not used");
.contains("Returns only linkable requirement candidates")
.contains("An empty result is a normal successful page")
.contains("booking detail calls are not used")
.doesNotContain("mismatchReasons", "disabledReason");
}
@Test
@@ -210,6 +210,21 @@ class OceanBookingServiceTest {
verify(repository, never()).containers(anyLong());
}
@Test
void linkCandidatesReturnsNormalEmptyPageWithOneSetQueryAndNoDiagnosticFields() {
when(repository.linkCandidates(any())).thenReturn(new PageResult<>(List.of(), 1, 20, 0, 0));
PageResult<LinkCandidate> result = service.linkCandidates(
new LinkCandidateQuery(701L, "SEA-US", "45HC", null, null));
assertThat(result.records()).isEmpty();
assertThat(result.total()).isZero();
assertThat(result.pages()).isZero();
verify(repository, times(1)).linkCandidates(any());
assertThat(LinkCandidate.class.getRecordComponents()).extracting(java.lang.reflect.RecordComponent::getName)
.doesNotContain("mismatchReasons", "disabledReason", "warehouseId", "channelCode");
}
@Test
void releaseRejectsInvalidScheduleWithoutTransition() {
OceanBookingEntity draft = completeBooking("DRAFT", 3);