Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(studio): the assistant column's tests give the thread's viewport the scrolling jsdom lacks

Maurice6b4d71ab0327
diff --git a/client/src/components/Studio/StudioAssistantPanel.test.tsx b/client/src/components/Studio/StudioAssistantPanel.test.tsx
index 921545665..044b7fe8a 100644
--- a/client/src/components/Studio/StudioAssistantPanel.test.tsx
+++ b/client/src/components/Studio/StudioAssistantPanel.test.tsx
@@ -12,7 +12,7 @@
* journey; the bar's switch and the column it opens.
*/
import type { AiStatusResponse } from '@trek/shared';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen, waitFor, within } from '../../../tests/helpers/render';
import { aiConnectionsRepo } from '../../repo/aiConnectionsRepo';
@@ -55,6 +55,11 @@ function running() {
return cancel;
}
+beforeAll(() => {
+ // jsdom lays nothing out and has no element scrolling; the thread's viewport only needs the call to exist.
+ Element.prototype.scrollTo = vi.fn() as unknown as typeof Element.prototype.scrollTo;
+});
+
beforeEach(() => {
vi.spyOn(assistantRepo, 'threads').mockResolvedValue([]);
useAssistantStore.setState({ ...INITIAL, status: STATUS, byTrip: {}, studioHosts: {} });