| 55 | } |
| 56 | |
| 57 | export function resetVSCodeMocks() { |
| 58 | generateMock('workspace'); |
| 59 | generateMock('window'); |
| 60 | generateMock('languages'); |
| 61 | generateMock('env'); |
| 62 | generateMock('debug'); |
| 63 | generateMock('scm'); |
| 64 | generateMock('env'); |
| 65 | generateMock('notebooks'); |
| 66 | generateMock('commands'); |
| 67 | generateMock('extensions'); |
| 68 | |
| 69 | // Workspace event emitters |
| 70 | const onDidChangeConfiguration = new vscodeMocks.vscMock.EventEmitter<vscode.ConfigurationChangeEvent>(); |
| 71 | const onDidCloseNotebookDocument = new vscodeMocks.vscMock.EventEmitter<vscode.NotebookDocument>(); |
| 72 | const onDidOpenNotebookDocument = new vscodeMocks.vscMock.EventEmitter<vscode.NotebookDocument>(); |
| 73 | const onDidGrantWorkspaceTrust = new vscodeMocks.vscMock.EventEmitter<void>(); |
| 74 | |
| 75 | when(mockedVSCodeNamespaces.workspace.notebookDocuments).thenReturn([]); |
| 76 | when(mockedVSCodeNamespaces.workspace.onDidChangeConfiguration).thenReturn(onDidChangeConfiguration.event); |
| 77 | when(mockedVSCodeNamespaces.workspace.onDidCloseNotebookDocument).thenReturn(onDidCloseNotebookDocument.event); |
| 78 | when(mockedVSCodeNamespaces.workspace.onDidOpenNotebookDocument).thenReturn(onDidOpenNotebookDocument.event); |
| 79 | when(mockedVSCodeNamespaces.workspace.onDidGrantWorkspaceTrust).thenReturn(onDidGrantWorkspaceTrust.event); |
| 80 | when(mockedVSCodeNamespaces.workspace.workspaceFolders).thenReturn(undefined); |
| 81 | when(mockedVSCodeNamespaces.workspace.isTrusted).thenReturn(true); |
| 82 | |
| 83 | when(mockedVSCodeNamespaces.window.visibleNotebookEditors).thenReturn([]); |
| 84 | when(mockedVSCodeNamespaces.window.activeTextEditor).thenReturn(undefined); |
| 85 | when(mockedVSCodeNamespaces.window.activeNotebookEditor).thenReturn(undefined); |
| 86 | |
| 87 | // Window dialog methods with overloads (1-5 parameters) |
| 88 | // showInformationMessage |
| 89 | when(mockedVSCodeNamespaces.window.showInformationMessage(anything())).thenResolve(undefined as any); |
| 90 | when(mockedVSCodeNamespaces.window.showInformationMessage(anything(), anything())).thenResolve(undefined as any); |
| 91 | when(mockedVSCodeNamespaces.window.showInformationMessage(anything(), anything(), anything())).thenResolve( |
| 92 | undefined as any |
| 93 | ); |
| 94 | when( |
| 95 | mockedVSCodeNamespaces.window.showInformationMessage(anything(), anything(), anything(), anything()) |
| 96 | ).thenResolve(undefined as any); |
| 97 | when( |
| 98 | mockedVSCodeNamespaces.window.showInformationMessage(anything(), anything(), anything(), anything(), anything()) |
| 99 | ).thenResolve(undefined as any); |
| 100 | |
| 101 | // showErrorMessage |
| 102 | when(mockedVSCodeNamespaces.window.showErrorMessage(anything())).thenResolve(undefined as any); |
| 103 | when(mockedVSCodeNamespaces.window.showErrorMessage(anything(), anything())).thenResolve(undefined as any); |
| 104 | when(mockedVSCodeNamespaces.window.showErrorMessage(anything(), anything(), anything())).thenResolve( |
| 105 | undefined as any |
| 106 | ); |
| 107 | when(mockedVSCodeNamespaces.window.showErrorMessage(anything(), anything(), anything(), anything())).thenResolve( |
| 108 | undefined as any |
| 109 | ); |
| 110 | when( |
| 111 | mockedVSCodeNamespaces.window.showErrorMessage(anything(), anything(), anything(), anything(), anything()) |
| 112 | ).thenResolve(undefined as any); |
| 113 | |
| 114 | // showWarningMessage |