fix(delivery): expose signed quantity and publish correct signature instant

This commit is contained in:
2026-10-03 23:09:24 +08:00
parent 0c8ede3889
commit 1f7ddf7bc9
11 changed files with 162 additions and 16 deletions
@@ -61,12 +61,28 @@ class DeliveryLongIdJsonContractTest {
});
}
private DeliveryResponses.DeliveryRow deliveryRow() {
@Test
void signedPackagesMustPreserveNullZeroAndPositiveDatabaseFacts() {
contextRunner.run(context -> {
ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
objectMapper.setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL);
for (Integer count : new Integer[] {null, 0, 3}) {
JsonNode json = objectMapper.readTree(objectMapper.writeValueAsString(deliveryRow(count)));
assertThat(json.has("signedPackages")).isTrue();
if (count == null) assertThat(json.get("signedPackages").isNull()).isTrue();
else assertThat(json.get("signedPackages").intValue()).isEqualTo(count);
}
});
}
private DeliveryResponses.DeliveryRow deliveryRow() { return deliveryRow(null); }
private DeliveryResponses.DeliveryRow deliveryRow(Integer signedPackages) {
return new DeliveryResponses.DeliveryRow(
DELIVERY_ID,
null, null, "PS-1", null, null, null, null, "CREATED", null,
null, null, null, null, null, null, null, null, null, null, null,
0, 0, null, null, null, null, null, null, null, null, 0, java.util.List.of(), null,
0, 0, signedPackages, null, null, null, null, null, null, null, null, 0, java.util.List.of(), null,
com.baiyue.lastleg.delivery.service.DeliveryDocumentSnapshot.summary(null), null, null, null,
null, null, null, null, null);
}