优化
This commit is contained in:
@@ -120,7 +120,7 @@ class PriceBookContractTest {
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
assertThat(firstlegOpenapi)
|
||||
.contains("/internal/firstleg/v1/pricing/channels/validate:")
|
||||
.contains("required: [tenantId, originWarehouseId, channelCode, destinationType]")
|
||||
.contains("同一渠道的包税与不包税订单共用编码前缀");
|
||||
.contains("required: [tenantId, originWarehouseId, channelCode, destinationType, requireInboundCodePrefix]")
|
||||
.contains("LEGACY_MANUAL 模式仅校验渠道可用性");
|
||||
}
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.baiyue.firstleg.repository;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class InboundCodeGlobalUniquenessContractTest {
|
||||
@Test
|
||||
void inboundSchemaUsesTheSamePlatformWideInboundCodeIndex() throws Exception {
|
||||
String sql = new ClassPathResource("db/phase2-inbound-schema.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
assertThat(sql)
|
||||
.contains("UNIQUE KEY uk_inbound_code (inbound_code)")
|
||||
.doesNotContain("UNIQUE KEY uk_inbound_tenant_code (tenant_id, inbound_code)");
|
||||
}
|
||||
}
|
||||
+15
-3
@@ -51,9 +51,9 @@ class MerchantPriceBookServiceTest {
|
||||
when(repository.channelPrefix("MATSON_CLX_TRUCK"))
|
||||
.thenReturn(new ChannelPrefixRow("MATSON_CLX_TRUCK", "ZBYHK", "ZBYHWK"));
|
||||
|
||||
assertThat(service.requireAvailableChannel(10001L, 10L, "matson_clx_truck", "FBA")
|
||||
assertThat(service.requireAvailableChannel(10001L, 10L, "matson_clx_truck", "FBA", true)
|
||||
.inboundCodePrefix()).isEqualTo("ZBYHK");
|
||||
assertThat(service.requireAvailableChannel(10001L, 10L, "MATSON_CLX_TRUCK", "OVERSEAS")
|
||||
assertThat(service.requireAvailableChannel(10001L, 10L, "MATSON_CLX_TRUCK", "OVERSEAS", true)
|
||||
.inboundCodePrefix()).isEqualTo("ZBYHWK");
|
||||
}
|
||||
|
||||
@@ -66,10 +66,22 @@ class MerchantPriceBookServiceTest {
|
||||
when(repository.channelPrefix("OA_HOUSTON_TRUCK"))
|
||||
.thenReturn(new ChannelPrefixRow("OA_HOUSTON_TRUCK", "HPHK", null));
|
||||
|
||||
assertThat(service.requireAvailableChannel(10001L, 10L, "OA_HOUSTON_TRUCK", "OVERSEAS")
|
||||
assertThat(service.requireAvailableChannel(10001L, 10L, "OA_HOUSTON_TRUCK", "OVERSEAS", true)
|
||||
.inboundCodePrefix()).isEqualTo("HPHK");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldValidateLegacyChannelWithoutRequiringAnInboundCodePrefix() {
|
||||
when(repository.activeVersionId()).thenReturn(7L);
|
||||
when(repository.channelAvailable(7L, 10L, "LEGACY_CHANNEL")).thenReturn(true);
|
||||
var response = service.requireAvailableChannel(
|
||||
10001L, 10L, "LEGACY_CHANNEL", "FBA", false);
|
||||
|
||||
assertThat(response.channelCode()).isEqualTo("LEGACY_CHANNEL");
|
||||
assertThat(response.inboundCodePrefix()).isNull();
|
||||
verify(repository, never()).channelPrefix("LEGACY_CHANNEL");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnEmptyChannelsWithoutActiveVersion() {
|
||||
when(repository.activeVersionId()).thenReturn(null);
|
||||
|
||||
Reference in New Issue
Block a user