Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

test(api): expect insufficient_credits on the generic 402 (#5531)

Rakshith Ramprakashf6003791a45a
diff --git a/apps/api/src/__tests__/routes/check-credits-middleware.test.ts b/apps/api/src/__tests__/routes/check-credits-middleware.test.ts
index 43c1d2e5f..fb01576c7 100644
--- a/apps/api/src/__tests__/routes/check-credits-middleware.test.ts
+++ b/apps/api/src/__tests__/routes/check-credits-middleware.test.ts
@@ -160,7 +160,10 @@ describe("checkCreditsMiddleware – Autumn overage handling", () => {
expect(res.status).toHaveBeenCalledWith(402);
expect(res.json).toHaveBeenCalledWith(
- expect.not.objectContaining({ code: expect.anything() }),
+ expect.objectContaining({
+ code: "insufficient_credits",
+ error: expect.not.stringContaining("contact that platform"),
+ }),
);
});