MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / setupGlobalMocks

Function setupGlobalMocks

tests/test-utils.tsx:34–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33// Setup global mocks
34export const setupGlobalMocks = () => {
35 // Chrome mock已经在vitest.setup.ts中通过chromeMock.init()设置了
36 vi.stubGlobal("open", vi.fn());
37 vi.stubGlobal("location", { href: "https://example.com" });
38 const matchMedia0 = {
39 matches: false,
40 addEventListener: vi.fn(),
41 };
42 vi.stubGlobal("matchMedia", () => matchMedia0);
43};
44
45export * from "@testing-library/react";
46export { customRender as render };

Callers 3

App.test.tsxFile · 0.90

Calls 1

fnMethod · 0.80

Tested by

no test coverage detected