功能增加

This commit is contained in:
andy committed 2026-09-11 15:33:18 +08:00
1 parent b340fc7ad7
commit f1993eb388
69 files changed
+2243 -162

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import { describe, expect, it } from "vitest";
import { normalizeBillingParameters } from "@/lib/server/billing-service";
import { DEFAULT_BILLING_PRICE_RULES } from "@/lib/server/billing-catalog";
describe("A4 billing metadata", () => {
it.each([[1680, 2376, "70:99"], [2376, 1680, "99:70"], [848, 1200, "70:99"], [1200, 848, "99:70"]])("recognizes %s × %s without changing the markup", (width, height, aspectRatio) => {
const dimensions = { width, height };
for (const payload of [dimensions, { input: dimensions }, { settings: dimensions }, { providerPayload: dimensions }]) {
expect(normalizeBillingParameters(payload)).toMatchObject({ aspectRatio, size: `${width}*${height}` });
}
const rule = DEFAULT_BILLING_PRICE_RULES.find((rule) => rule.id === "base-evolink-gpt-image-2")!;
const dimension = rule.parameterDimensions!.find((dimension) => dimension.key === "aspectRatio")!;
expect(dimension.tiers.find((tier) => tier.value === aspectRatio)).toMatchObject({ standardFactor: 1, markupMultiplier: 1.2, enabled: true });
});
});