34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import {
|
|
isAlibabaQwenImage3ModelId,
|
|
resolveAlibabaImageAsyncEndpoint,
|
|
resolveAlibabaImageTaskEndpoint,
|
|
} from "@/lib/ai/providers/alibaba-image-api";
|
|
|
|
test.describe("Alibaba image async routing", () => {
|
|
test("identifies Qwen Image 3 models", () => {
|
|
expect(isAlibabaQwenImage3ModelId("qwen-image-3.0")).toBe(true);
|
|
expect(isAlibabaQwenImage3ModelId("qwen-image-3.0-plus")).toBe(true);
|
|
expect(isAlibabaQwenImage3ModelId("qwen-image-edit-plus")).toBe(false);
|
|
});
|
|
|
|
test("routes Qwen Image 3 submissions to the async image endpoint", () => {
|
|
expect(
|
|
resolveAlibabaImageAsyncEndpoint(
|
|
"https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
|
|
),
|
|
).toBe(
|
|
"https://dashscope.aliyuncs.com/api/v1/services/aigc/image-generation/generation",
|
|
);
|
|
});
|
|
|
|
test("builds the task endpoint without retaining query parameters", () => {
|
|
expect(
|
|
resolveAlibabaImageTaskEndpoint(
|
|
"https://dashscope.aliyuncs.com/api/v1/services/aigc/image-generation/generation?workspace=x",
|
|
"task/id",
|
|
),
|
|
).toBe("https://dashscope.aliyuncs.com/api/v1/tasks/task%2Fid");
|
|
});
|
|
});
|