From 2b5d438bc3a9c11e2f4815167c5561b27e2445e2 Mon Sep 17 00:00:00 2001 From: Molly Draven Date: Fri, 26 Jul 2024 19:52:27 -0400 Subject: [PATCH] test: add comment explaining why 200 is the expected response code for errors --- libs/web/test/routes.test.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libs/web/test/routes.test.ts b/libs/web/test/routes.test.ts index 345cbb3..e2077f5 100644 --- a/libs/web/test/routes.test.ts +++ b/libs/web/test/routes.test.ts @@ -1,11 +1,7 @@ -import { describe, expect, it, test } from "vitest"; +import { describe, expect, test } from "vitest"; import { RouteHandlers, User } from "#internal"; describe("RouteHandlers", () => { - it("should have a handler for /AuthLogin", () => { - expect(RouteHandlers["/AuthLogin"]).toBeDefined(); - }); - test("when /AuthLogin is called with a missing username, expect a generic error", async () => { // Arrange const searchParams = new URLSearchParams(); @@ -22,7 +18,7 @@ describe("RouteHandlers", () => { const response = await RouteHandlers["/AuthLogin"](info); // Assert - expect(response.statusCode).toBe(200); + expect(response.statusCode).toBe(200); // The legacy client expects a 200 status code and a specific response body expect(response.body).toBe( "reasoncode=INV-200\nreasontext=Unable to login\nreasonurl=https://rusty-motors.com" ); @@ -45,7 +41,7 @@ describe("RouteHandlers", () => { const response = await RouteHandlers["/AuthLogin"](info); // Assert - expect(response.statusCode).toBe(200); + expect(response.statusCode).toBe(200); // The legacy client expects a 200 status code and a specific response body expect(response.body).toBe( "reasoncode=INV-200\nreasontext=Unable to login\nreasonurl=https://rusty-motors.com" );