优化
This commit is contained in:
+10
@@ -1,11 +1,13 @@
|
||||
package com.baiyue.firstleg.dashboard;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -30,4 +32,12 @@ class DashboardMetricsContractTest {
|
||||
"COUNT(DISTINCT inbound.order_id)", "customs_container.status <> 'COMPLETED'",
|
||||
"item.deleted = 0", "inbound.deleted = 0", "LIKE '20%'", "LIKE '40%'", "LIKE '45%'");
|
||||
}
|
||||
|
||||
@Test void openApiDocumentsTheCurrentPointInTimeDefinitions() throws Exception {
|
||||
var openApi = new ClassPathResource("openapi/dashboard-metrics-v1.yaml")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
assertThat(openApi).contains("/api/platform/v1/first-leg/dashboard/operational-metrics:",
|
||||
"inTransitContainerCount:", "inTransitTeu:", "unknownContainerTypeCount:",
|
||||
"pendingCustomsOrderCount:", "本接口只返回当前时点事实,不提供历史环比");
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -69,6 +69,31 @@ class InboundCartonLabelPrintServiceTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void multiplePreGeneratedPalletsAreReturnedInOnePdf() {
|
||||
Pallet first = dropshipPallet("OPEN");
|
||||
Pallet second = new Pallet(90002L, "DP-260911-0002", "OPEN", 0, 0, 0,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO, 1, List.of(), List.of(), null);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_PDF);
|
||||
when(print.generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
|
||||
org.mockito.ArgumentMatchers.eq("request-all"), org.mockito.ArgumentMatchers.any()))
|
||||
.thenReturn(new ResponseEntity<>(new byte[] {4, 5, 6}, headers,
|
||||
org.springframework.http.HttpStatus.OK));
|
||||
|
||||
ResponseEntity<byte[]> response = service.generateDropshipPallets(
|
||||
List.of(first, second), "PCHK2608040174", "request-all");
|
||||
|
||||
ArgumentCaptor<PrintPdfClient.DropshipPalletA4PdfRequest> request =
|
||||
ArgumentCaptor.forClass(PrintPdfClient.DropshipPalletA4PdfRequest.class);
|
||||
verify(print).generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.eq("internal-token"),
|
||||
org.mockito.ArgumentMatchers.eq("request-all"), request.capture());
|
||||
assertThat(request.getValue().documents()).extracting("palletNo")
|
||||
.containsExactly("DP-260911-0001", "DP-260911-0002");
|
||||
assertThat(request.getValue().downloadFileName()).contains("2托");
|
||||
assertThat(response.getBody()).containsExactly(4, 5, 6);
|
||||
}
|
||||
|
||||
@Test
|
||||
void forwardsStableLabelsAndOnlySafePdfHeaders() {
|
||||
when(labels.list(10001L, 70001L, List.of(1))).thenReturn(batch());
|
||||
|
||||
Reference in New Issue
Block a user