Refine onboarding integration test mocks
cgen-b194d7af77dd428c8df3950f288341f8
This commit is contained in:
parent
bc3b8f9d20
commit
62971899ee
1 changed files with 5 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { describe, it, expect, beforeEach, vi } from "vitest";
|
import { describe, it, expect, beforeEach, vi, type Mock } from "vitest";
|
||||||
|
|
||||||
const createStorage = () => {
|
const createStorage = () => {
|
||||||
const store = new Map<string, string>();
|
const store = new Map<string, string>();
|
||||||
|
|
@ -32,6 +32,8 @@ vi.stubGlobal(
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const fetchMock = fetch as unknown as Mock;
|
||||||
|
|
||||||
vi.mock("@/lib/supabase", () => {
|
vi.mock("@/lib/supabase", () => {
|
||||||
const chain = () => ({
|
const chain = () => ({
|
||||||
select: () => chain(),
|
select: () => chain(),
|
||||||
|
|
@ -104,8 +106,8 @@ describe("onboarding passport flow", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
await mockAuth.signOut();
|
await mockAuth.signOut();
|
||||||
(fetch as unknown as vi.Mock).mockReset();
|
fetchMock.mockReset();
|
||||||
(fetch as unknown as vi.Mock).mockResolvedValue({
|
fetchMock.mockResolvedValue({
|
||||||
ok: false,
|
ok: false,
|
||||||
status: 404,
|
status: 404,
|
||||||
text: async () => "",
|
text: async () => "",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue