From 43767cb952e058942faf4307402608f1b33f4bf3 Mon Sep 17 00:00:00 2001 From: acouch Date: Fri, 3 Jan 2025 13:52:42 -0500 Subject: [PATCH] Add env/route.test.ts --- frontend/tests/api/env/route.test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 frontend/tests/api/env/route.test.ts diff --git a/frontend/tests/api/env/route.test.ts b/frontend/tests/api/env/route.test.ts new file mode 100644 index 000000000..b0a0e49db --- /dev/null +++ b/frontend/tests/api/env/route.test.ts @@ -0,0 +1,20 @@ +/** + * @jest-environment node + */ + +import { GET } from "src/app/api/env/route"; + +jest.mock("src/constants/environments", () => ({ + environment: { + AUTH_LOGIN_URL: "testable", + }, +})); + +describe("/api/env GET handler", () => { + afterEach(() => jest.clearAllMocks()); + it("gets correct envars", async () => { + const resp = GET(); + const data = (await resp.json()) as { auth_login_url: string }; + expect(data.auth_login_url).toBe("testable"); + }); +});