Skip to content

Commit

Permalink
test: add router test
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Feb 11, 2025
1 parent 9e43795 commit 545ad77
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .internal/tests/no-sample-code.test.mjs.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ exports[`no-sample-code > should put files 1`] = `
"internal-tests-output-no-sample-code/src/app/_utils/zod.test.ts",
"internal-tests-output-no-sample-code/src/app/_utils/zod.ts",
"internal-tests-output-no-sample-code/src/app/api/auth/[...nextauth]/route.ts",
"internal-tests-output-no-sample-code/src/app/api/health/route.test.ts",
"internal-tests-output-no-sample-code/src/app/api/health/route.ts",
"internal-tests-output-no-sample-code/src/app/error.tsx",
"internal-tests-output-no-sample-code/src/app/favicon.ico",
Expand Down
17 changes: 17 additions & 0 deletions src/app/api/health/route.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { GET } from "./route";

describe("api/health", () => {
describe("GET /", () => {
it("should return 200", async () => {
const res = await GET();

expect(await res.json()).toMatchInlineSnapshot(`
{
"status": "ok",
}
`);
expect(res.status).toBe(200);
});
});
});

0 comments on commit 545ad77

Please # to comment.