52 lines
2.0 KiB
TypeScript
52 lines
2.0 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
describe("Go provider adapter contract", () => {
|
|
it("freezes bounded adapters and safe errors", async () => {
|
|
const contract = JSON.parse(await readFile(new URL("../contracts/providers/http-v1.json", import.meta.url), "utf8"));
|
|
expect(Object.keys(contract.providers)).toEqual(["volcengine-visual", "evolink", "bailian", "seedance", "seedream", "minimax"]);
|
|
expect(contract.providers["volcengine-visual"]).toMatchObject({
|
|
model: "jimeng_seedream46_cvtob",
|
|
submitAction: "JimengSeedream46CVToBSubmitTask",
|
|
queryAction: "JimengSeedream46CVToBGetResult",
|
|
version: "2024-06-06"
|
|
});
|
|
expect(contract.providers.seedance).toMatchObject({
|
|
model: "doubao-seedance-2-0-260128",
|
|
models: ["doubao-seedance-2-0-260128", "doubao-seedance-2-5-260628"],
|
|
submit: "/contents/generations/tasks",
|
|
query: "/contents/generations/tasks/{id}",
|
|
maxMaterials: {
|
|
"doubao-seedance-2-0-260128": 4,
|
|
"doubao-seedance-2-5-260628": 50
|
|
},
|
|
maxDurationSeconds: {
|
|
"doubao-seedance-2-0-260128": 15,
|
|
"doubao-seedance-2-5-260628": 30
|
|
},
|
|
resolutions: ["480p", "720p", "1080p"]
|
|
});
|
|
expect(contract.providers.seedream).toMatchObject({
|
|
model: "doubao-seedream-5-0-pro-260628",
|
|
submit: "/images/generations",
|
|
auth: "bearer",
|
|
synchronous: true,
|
|
maxReferenceImages: 10,
|
|
sizes: ["1K", "1.5K", "2K"],
|
|
outputFormats: ["png", "jpeg"],
|
|
optimizeModes: ["standard", "fast"]
|
|
});
|
|
expect(contract.providers.minimax).toMatchObject({
|
|
model: "MiniMax-H3",
|
|
submit: "/v2/video_generation",
|
|
query: "/v2/query/video_generation/{id}",
|
|
modes: ["text-to-video", "first-frame-to-video"],
|
|
maxMaterials: 1,
|
|
durationSeconds: { min: 4, max: 15 },
|
|
resolutions: ["768P", "2K"]
|
|
});
|
|
expect(contract.errors).toEqual({ generic: true, secretSafe: true });
|
|
expect(contract.liveCallsInTests).toBe(false);
|
|
});
|
|
});
|