Skip to content

Commit

Permalink
feat: add pages router test to nextjs/vercel-ai-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ytkimirti committed Oct 24, 2024
1 parent 807f751 commit 12ea46d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/nextjs/vercel-ai-sdk/ci.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ test(
},
{ timeout: 20_000 }
);

test("pages router test route should return 200", async () => {
const response = await fetch(`${deploymentURL}/api/pages-test`);

expect(response.status).toBe(200);
});
14 changes: 14 additions & 0 deletions examples/nextjs/vercel-ai-sdk/src/pages/api/pages-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { RAGChat } from "@upstash/rag-chat";
import { NextApiRequest, NextApiResponse } from "next";

// This is a test route to check if imports are working with pages router
export default async function handler(_req: NextApiRequest, res: NextApiResponse) {
const ragChat = new RAGChat({});

await ragChat.context.add({
type: "text",
data: "This is context added from the pages router example",
});

res.status(200).json({ message: "OK" });
}

0 comments on commit 12ea46d

Please sign in to comment.