test(web): provide favicon environment in desktop boot fixture

This commit is contained in:
Turtle committed 2026-09-20 20:05:17 +08:00
1 parent 6b9c01996f
commit f2a22a3108
1 file changed
+7 -1
+7 -1
View File
@@ -1,5 +1,5 @@
// @vitest-environment jsdom
import { afterEach, expect, it, vi } from 'vitest'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
const boot = vi.hoisted(() => ({
run: vi.fn(),
@@ -10,10 +10,16 @@ vi.mock('@deepseek-ai/dsh-client-web', () => ({
applyIndexInjections: boot.applyIndexInjections,
}))
beforeEach(() => {
document.head.innerHTML = '<link rel="icon" type="image/svg+xml" href="/favicon.svg">'
vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener: vi.fn() }))
})
afterEach(() => {
vi.unstubAllGlobals()
vi.clearAllMocks()
vi.resetModules()
document.head.replaceChildren()
document.body.replaceChildren()
})