fix: keep terminal drayage actions executable

This commit is contained in:
2026-09-08 07:39:17 +08:00
parent 287c0f3ce8
commit 61ffff1be0
2 changed files with 14 additions and 1 deletions
@@ -154,6 +154,19 @@ class TerminalDrayageServiceTest {
assertThat(service.detail(11L).emptyReturnWarning().overdueHours()).isZero();
}
@Test
void doesNotOfferEmptyReturnWithoutExecutableDrayageAggregate() {
LocalDateTime unloadedAt = LocalDateTime.of(2026, 9, 3, 0, 0);
Context context = context("PICKED_UP", unloadedAt);
when(mapper.context(11L)).thenReturn(context);
when(mapper.find(11L)).thenReturn(null);
var result = service.detail(11L);
assertThat(result.status()).isEqualTo("UNLOADED");
assertThat(result.allowedActions()).doesNotContain("RECORD_EMPTY_RETURN");
}
@Test
void sameIdempotencyKeyWithDifferentPayloadConflictsWithoutWriting() {
Context context = context("ARRIVED_DESTINATION_PORT", null);