forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ts
More file actions
33 lines (29 loc) · 854 Bytes
/
Copy pathsetup.ts
File metadata and controls
33 lines (29 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Test setup file for Vitest
import { afterEach, vi } from "vitest";
import { cleanup } from "@testing-library/react";
// Mock ResizeObserver which is not available in jsdom
global.ResizeObserver = class ResizeObserver {
constructor(callback: ResizeObserverCallback) {
this.callback = callback;
}
callback: ResizeObserverCallback;
observe() {}
unobserve() {}
disconnect() {}
};
// Mock scrollIntoView which is not available in jsdom
HTMLElement.prototype.scrollIntoView = vi.fn();
// Ensure we cleanup between tests to avoid lingering handles
afterEach(() => {
cleanup();
});
// Mock @copilotkit/react-core/v2
vi.mock("@copilotkit/react-core/v2", () => ({
useCopilotKit: vi.fn(() => ({
copilotkit: {
properties: {},
setProperties: vi.fn(),
runAgent: vi.fn().mockResolvedValue(undefined),
},
})),
}));