Skip to content

Commit

Permalink
😃weird login test has been fixed and is confirmed to 401 on unauthori…
Browse files Browse the repository at this point in the history
…zed user <0001f975><0001f975>🥵
  • Loading branch information
Plebbaroni committed Nov 12, 2024
1 parent 209ba9e commit ea80f6b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions backend/tests/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,29 @@ describe("Tests", () => {
});
expect(response2.status).toBe(200);

Check failure on line 47 in backend/tests/login.test.ts

View workflow job for this annotation

GitHub Actions / integration-tests

tests/login.test.ts > Tests > Login Successful

AssertionError: expected 401 to be 200 // Object.is equality - Expected + Received - 200 + 401 ❯ tests/login.test.ts:47:30
});

test("Unauthorized User", async () => {
const { status, body } = await request(app).post("/auth/register").send({
username: "shinjisatoo",
password: "testpassword",
email: "[email protected]",
userType: "ATTENDEE",
});

const newUser = await prisma.user.findFirst({
where: {
id: body.newUser.id,
},
});
if (newUser == null) return;
expect(status).toBe(201);
expect(newUser).not.toBeNull();

const response2 = await request(app)
.get("/user")
.send({
userId: newUser.id,
});
expect(response2.status).toBe(401);
})
});

0 comments on commit ea80f6b

Please sign in to comment.