Skip to content

Commit

Permalink
test: add comment explaining why 200 is the expected response code fo…
Browse files Browse the repository at this point in the history
…r errors
  • Loading branch information
drazisil committed Jul 26, 2024
1 parent 73809f8 commit 2b5d438
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions libs/web/test/routes.test.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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"
);
Expand All @@ -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"
);
Expand Down

0 comments on commit 2b5d438

Please sign in to comment.