Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve type
  • Loading branch information
BrunoQuaresma committed Mar 18, 2024
commit 089680d578b06ea549aeb166250d1a1271b79ca5
27 changes: 12 additions & 15 deletions site/src/pages/SetupPage/SetupPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { HttpResponse, type StrictResponse, http } from "msw";
import { HttpResponse, http } from "msw";
import { createMemoryRouter } from "react-router-dom";
import type { Response, User } from "api/typesGenerated";
import { MockUser } from "testHelpers/entities";
Expand Down Expand Up @@ -53,21 +53,18 @@ describe("Setup Page", () => {
let userHasBeenCreated = false;

server.use(
http.get(
"/api/v2/users/me",
async (): Promise<StrictResponse<User | Response>> => {
if (!userHasBeenCreated) {
return HttpResponse.json(
{ message: "no user here" },
{ status: 401 },
);
}
return HttpResponse.json(MockUser);
},
),
http.get(
http.get<never, null, User | Response>("/api/v2/users/me", async () => {
if (!userHasBeenCreated) {
return HttpResponse.json(
{ message: "no user here" },
{ status: 401 },
);
}
return HttpResponse.json(MockUser);
}),
http.get<never, null, User | Response>(
"/api/v2/users/first",
async (): Promise<StrictResponse<User | Response>> => {
async () => {
if (!userHasBeenCreated) {
return HttpResponse.json(
{ message: "no first user has been created" },
Expand Down