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