Use server enterprise video pricing
Web Quality / verify (push) Has been cancelled
Web Quality / verify (pull_request) Has been cancelled

This commit is contained in:
2026-06-10 14:27:42 +08:00
parent d28889fd0c
commit 9e080bbb8f
5 changed files with 330 additions and 49 deletions
+37
View File
@@ -2,6 +2,7 @@ import { describe, expect, it } from "../test/testHarness";
import {
calculateEnterpriseVideoCredits,
type EnterpriseVideoPricingConfig,
getEnterpriseVideoCreditRate,
normalizeEnterpriseResolution,
} from "./enterpriseVideoPolicy";
@@ -45,4 +46,40 @@ describe("enterpriseVideoPolicy", () => {
}),
).toBe(1);
});
it("uses server-provided pricing config before fallback pricing", () => {
const serverPricing: EnterpriseVideoPricingConfig = {
creditsPerCny: 100,
defaultResolution: "1080P",
rules: [
{
id: "happyhorse-server",
modelIncludes: ["happyhorse"],
rates: { "720P": 2, "1080P": 3 },
},
],
};
expect(
getEnterpriseVideoCreditRate(
{
model: "happyhorse-1.0",
resolution: "1080P",
durationSeconds: 5,
},
serverPricing,
),
).toBe(3);
expect(
calculateEnterpriseVideoCredits(
{
model: "happyhorse-1.0",
resolution: "1080P",
durationSeconds: 5,
},
serverPricing,
),
).toBe(1500);
});
});