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