MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / createMockContext

Function createMockContext

src/utils/__tests__/networkProxy.spec.ts:27–61  ·  view source on GitHub ↗
(mode: vscode.ExtensionMode = vscode.ExtensionMode.Production)

Source from the content-addressed store, hash-verified

25
26 // Helper to create mock context with configurable extensionMode
27 function createMockContext(mode: vscode.ExtensionMode = vscode.ExtensionMode.Production): vscode.ExtensionContext {
28 return {
29 extensionMode: mode,
30 subscriptions: [],
31 extensionPath: "/test/path",
32 globalState: {
33 get: vi.fn(),
34 update: vi.fn(),
35 keys: vi.fn().mockReturnValue([]),
36 setKeysForSync: vi.fn(),
37 },
38 workspaceState: {
39 get: vi.fn(),
40 update: vi.fn(),
41 keys: vi.fn().mockReturnValue([]),
42 },
43 secrets: {
44 get: vi.fn(),
45 store: vi.fn(),
46 delete: vi.fn(),
47 onDidChange: vi.fn(),
48 },
49 extensionUri: { fsPath: "/test/path" } as vscode.Uri,
50 globalStorageUri: { fsPath: "/test/global" } as vscode.Uri,
51 logUri: { fsPath: "/test/logs" } as vscode.Uri,
52 storageUri: { fsPath: "/test/storage" } as vscode.Uri,
53 storagePath: "/test/storage",
54 globalStoragePath: "/test/global",
55 logPath: "/test/logs",
56 asAbsolutePath: vi.fn((p) => `/test/path/${p}`),
57 environmentVariableCollection: {} as vscode.GlobalEnvironmentVariableCollection,
58 extension: {} as vscode.Extension<unknown>,
59 languageModelAccessInformation: {} as vscode.LanguageModelAccessInformation,
60 } as unknown as vscode.ExtensionContext
61 }
62
63 beforeEach(() => {
64 vi.clearAllMocks()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected