This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "../test/testHarness";
|
||||
|
||||
import {
|
||||
calculateEnterpriseVideoCredits,
|
||||
getEnterpriseVideoCreditRate,
|
||||
normalizeEnterpriseResolution,
|
||||
} from "./enterpriseVideoPolicy";
|
||||
|
||||
describe("enterpriseVideoPolicy", () => {
|
||||
it("keeps video billing at 1 CNY to 100 credits", () => {
|
||||
expect(
|
||||
calculateEnterpriseVideoCredits({
|
||||
model: "happyhorse-1.0",
|
||||
resolution: "1080P",
|
||||
durationSeconds: 5,
|
||||
}),
|
||||
).toBe(640);
|
||||
|
||||
expect(
|
||||
calculateEnterpriseVideoCredits({
|
||||
model: "wan2.7-i2v",
|
||||
resolution: "720P",
|
||||
durationSeconds: 5,
|
||||
}),
|
||||
).toBe(300);
|
||||
});
|
||||
|
||||
it("rounds duration up to the next second before billing", () => {
|
||||
expect(
|
||||
calculateEnterpriseVideoCredits({
|
||||
model: "vidu-q3-turbo",
|
||||
resolution: "1080P",
|
||||
durationSeconds: 5.2,
|
||||
}),
|
||||
).toBe(600);
|
||||
});
|
||||
|
||||
it("normalizes unsupported resolutions to 1080P", () => {
|
||||
expect(normalizeEnterpriseResolution("4K")).toBe("1080P");
|
||||
expect(
|
||||
getEnterpriseVideoCreditRate({
|
||||
model: "pixverse-c1",
|
||||
resolution: "4K",
|
||||
durationSeconds: 5,
|
||||
}),
|
||||
).toBe(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user