Skip to content

Commit

Permalink
api: Add test for segment-anything-2
Browse files Browse the repository at this point in the history
  • Loading branch information
victorges committed Sep 16, 2024
1 parent 0d0ff68 commit a37bdad
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/api/src/controllers/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe("controllers/generate", () => {
"image-to-image",
"image-to-video",
"upscale",
"segment-anything-2",
];
for (const api of apis) {
aiGatewayServer.app.post(`/${api}`, async (req, res) => {
Expand Down Expand Up @@ -213,6 +214,19 @@ describe("controllers/generate", () => {
});
expect(aiGatewayCalls).toEqual({ upscale: 1 });
});

it("should call the AI Gateway for generate API /segment-anything-2", async () => {
const res = await client.fetch("/beta/generate/segment-anything-2", {
method: "POST",
body: buildMultipartBody({}),
});
expect(res.status).toBe(200);
expect(await res.json()).toEqual({
message: "success",
reqContentType: expect.stringMatching("^multipart/form-data"),
});
expect(aiGatewayCalls).toEqual({ "segment-anything-2": 1 });
});
});

describe("validates multipart schema", () => {
Expand Down

0 comments on commit a37bdad

Please sign in to comment.