Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
test(web): keep two order-dependent tests correct in any order
shoudi zhengddc03f140198
diff --git a/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx b/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsxindex a93d3842..2ddb9a68 100644--- a/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx+++ b/apps/web/src/features/rooms/documents/document-voice-selection-control.test.tsx@@ -1,6 +1,14 @@import { fireEvent, render, screen, within } from "@testing-library/react";import { createRef, type ReactNode } from "react";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import {+ afterEach,+ beforeAll,+ beforeEach,+ describe,+ expect,+ it,+ vi,+} from "vitest";import { DocumentVoiceSelectionControl } from "./document-voice-selection-control";@@ -16,6 +24,13 @@ vi.mock("../chat/voice-mode/voice-materials-context", () => ({useOptionalVoiceMaterials: () => (context.enabled ? context : undefined),}));+// React binds its own document selectionchange listener on its first render.+// Render once before any test so a test that counts document listeners counts+// only the control's, whichever test runs first.+beforeAll(() => {+ render(<span />).unmount();+});+beforeEach(() => {context.acceptsDocuments = true;context.enabled = true;diff --git a/apps/web/src/features/rooms/room-navigation-hover.test.tsx b/apps/web/src/features/rooms/room-navigation-hover.test.tsxindex 1055a36d..dc2cfb4e 100644--- a/apps/web/src/features/rooms/room-navigation-hover.test.tsx+++ b/apps/web/src/features/rooms/room-navigation-hover.test.tsx@@ -1,17 +1,21 @@import { readFileSync } from "node:fs";import { resolve } from "node:path";-import { afterAll, describe, expect, it } from "vitest";+import { beforeEach, describe, expect, it } from "vitest";+// Only the local rules are needed; jsdom cannot load Tailwind's CSS import.const navigationStyles = readFileSync(resolve(import.meta.dirname, "../../app/globals.css"),"utf8",-);-const stylesheet = document.createElement("style");-// Only the local rules are needed; jsdom cannot load Tailwind's CSS import.-stylesheet.textContent = navigationStyles.replace(/^@import .*;$/gm, "");-document.head.append(stylesheet);+).replace(/^@import .*;$/gm, "");+let stylesheet: HTMLStyleElement;-afterAll(() => stylesheet.remove());+// The shared test setup removes head nodes after each test, so each test+// attaches its own copy.+beforeEach(() => {+ stylesheet = document.createElement("style");+ stylesheet.textContent = navigationStyles;+ document.head.append(stylesheet);+});describe("collapsed navigation hover targets", () => {it.each([