prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey
1import { vi } from "vitest";
2import "@testing-library/jest-dom/vitest";
3
4// Mock @monaco-editor/react BEFORE any imports
5vi.mock("@monaco-editor/react", () => ({
6 default: vi.fn(() => null),
7 useMonaco: vi.fn(() => null),
8 loader: {
9 config: vi.fn(),
10 init: vi.fn(() => Promise.resolve({})),
11 },
12}));
13
14global.fetch = vi.fn(
15 () =>
16 Promise.resolve({
17 text: () => Promise.resolve(""),
18 }) as any,
19);
20
21// Mock MonacoEnvironment
22(global as any).MonacoEnvironment = {
23 getWorker: () => ({}) as any,
24};
25
26Object.defineProperty(window, "matchMedia", {
27 writable: true,
28 value: vi.fn().mockImplementation((query) => ({
29 matches: false,
30 media: query,
31 onchange: null,
32 addListener: vi.fn(),
33 removeListener: vi.fn(),
34 addEventListener: vi.fn(),
35 removeEventListener: vi.fn(),
36 dispatchEvent: vi.fn(),
37 })),
38});