MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / createMockMap

Function createMockMap

packages/core/src/runtime/adapters/mapbox.test.ts:11–22  ·  view source on GitHub ↗
(opts?: { loaded?: boolean })

Source from the content-addressed store, hash-verified

9const mapWindow = window as Window & { __hfMapbox?: MapboxMapLike[] };
10
11function createMockMap(opts?: { loaded?: boolean }): MapboxMapLike {
12 const listeners: Record<string, (() => void)[]> = {};
13 return {
14 loaded: vi.fn(() => opts?.loaded ?? false),
15 on: vi.fn((event: string, cb: () => void) => {
16 (listeners[event] ??= []).push(cb);
17 }),
18 _fire(event: string) {
19 for (const cb of listeners[event] ?? []) cb();
20 },
21 } as MapboxMapLike & { _fire: (e: string) => void };
22}
23
24describe("mapbox adapter", () => {
25 beforeEach(() => {

Callers 1

mapbox.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected