fix: reconcile source currencies and retail token pricing

This commit is contained in:
wlx committed 2026-10-12 17:42:30 +08:00
1 parent ea9069e332
commit 512ca52262
12 files changed
+458 -12

No files matched your search

@@ -2,10 +2,23 @@ package com.moyi.controlplane.catalog;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import java.util.Map;
import com.moyi.controlplane.common.ApiException;
import org.junit.jupiter.api.Test;
class CatalogServiceTest {
@Test
void pricingRejectsAmbiguousCurrencyAndDiscountTypos() {
assertThrows(ApiException.class, () -> CatalogService.validatePricing(Map.of("listPriceCny", Map.of("input", 1), "listPriceUsd", Map.of("input", 1))));
assertThrows(ApiException.class, () -> CatalogService.validatePricing(Map.of("discount", 55)));
assertThrows(ApiException.class, () -> CatalogService.validatePricing(Map.of("listPriceCny", Map.of("input", 1), "exchangeRate", 7.2)));
assertDoesNotThrow(() -> CatalogService.validatePricing(Map.of("listPriceCny", Map.of("input", 1), "exchangeRate", 1, "discount", 5.5)));
assertDoesNotThrow(() -> CatalogService.validatePricing(Map.of("listPriceUsd", Map.of("input", 1), "exchangeRate", 7.2, "discount", 5.6)));
assertDoesNotThrow(() -> CatalogService.validatePricing(Map.of("price", 1.44, "unit", "CNY / task")));
}
@Test
void asyncReadinessMatchesImplementedAdapters() {
assertTrue(CatalogService.asyncExecutorReady("provider-vast", "http", "3d"));