From a37bdad5c19178916ffbce7ac5b3b328c5bd031d Mon Sep 17 00:00:00 2001 From: Victor Elias Date: Mon, 16 Sep 2024 13:16:07 -0300 Subject: [PATCH] api: Add test for segment-anything-2 --- packages/api/src/controllers/generate.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/api/src/controllers/generate.test.ts b/packages/api/src/controllers/generate.test.ts index 4e3e49d3a..4b2c0f078 100644 --- a/packages/api/src/controllers/generate.test.ts +++ b/packages/api/src/controllers/generate.test.ts @@ -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) => { @@ -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", () => {