diff --git a/apps/web/tests/desktop-boot.spec.ts b/apps/web/tests/desktop-boot.spec.ts index cac91ad7e7..9bea3def5f 100644 --- a/apps/web/tests/desktop-boot.spec.ts +++ b/apps/web/tests/desktop-boot.spec.ts @@ -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 = '' + vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener: vi.fn() })) +}) + afterEach(() => { vi.unstubAllGlobals() vi.clearAllMocks() vi.resetModules() + document.head.replaceChildren() document.body.replaceChildren() })