diff --git a/ui/src/ui/navigation.browser.test.ts b/ui/src/ui/navigation.browser.test.ts index 6d3ed399bac..0eafe9947e5 100644 --- a/ui/src/ui/navigation.browser.test.ts +++ b/ui/src/ui/navigation.browser.test.ts @@ -1,9 +1,13 @@ -import { describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it, vi } from "vitest"; import "../test-helpers/load-styles.ts"; import { mountApp as mountTestApp, registerAppMountHooks } from "./test-helpers/app-mount.ts"; registerAppMountHooks(); +afterEach(() => { + vi.restoreAllMocks(); +}); + function mountApp(pathname: string) { return mountTestApp(pathname); } @@ -375,6 +379,10 @@ describe("control UI routing", () => { }); it("auto-scrolls chat history to the latest message", async () => { + vi.spyOn(window, "requestAnimationFrame").mockImplementation((callback) => { + queueMicrotask(() => callback(performance.now())); + return 1; + }); const app = mountApp("/chat"); await app.updateComplete;