this repo has no description
1import "@testing-library/jest-dom/vitest";
2import { afterEach, beforeEach, vi } from "vitest";
3import { _testReset } from "../lib/auth.svelte";
4
5let locationHash = "";
6
7Object.defineProperty(window, "location", {
8 value: {
9 get hash() {
10 return locationHash;
11 },
12 set hash(value: string) {
13 locationHash = value.startsWith("#") ? value : `#${value}`;
14 },
15 href: "http://localhost:3000/",
16 origin: "http://localhost:3000",
17 pathname: "/",
18 search: "",
19 assign: vi.fn(),
20 replace: vi.fn(),
21 reload: vi.fn(),
22 },
23 writable: true,
24 configurable: true,
25});
26
27beforeEach(() => {
28 vi.clearAllMocks();
29 localStorage.clear();
30 sessionStorage.clear();
31 locationHash = "";
32 _testReset();
33});
34
35afterEach(() => {
36 vi.restoreAllMocks();
37});