diff options
Diffstat (limited to 'extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts')
-rw-r--r-- | extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts index 0f85b437235..89535dc5531 100644 --- a/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts +++ b/extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts @@ -17,7 +17,7 @@ async function createInteractiveWindow(kernel: Kernel) { // Keep focus on the owning file if there is one { viewColumn: vscode.ViewColumn.Beside, preserveFocus: false }, undefined, - kernel.controller.id, + `vscode.vscode-api-tests/${kernel.controller.id}`, undefined )) as unknown as INativeInteractiveWindow; @@ -45,11 +45,13 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument, i: const testDisposables: vscode.Disposable[] = []; let defaultKernel: Kernel; + let secondKernel: Kernel; setup(async function () { - // there should be ONE default kernel in this suite defaultKernel = new Kernel('mainKernel', 'Notebook Default Kernel', 'interactive'); + secondKernel = new Kernel('secondKernel', 'Notebook Secondary Kernel', 'interactive'); testDisposables.push(defaultKernel.controller); + testDisposables.push(secondKernel.controller); await saveAllFilesAndCloseAll(); }); @@ -85,4 +87,22 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument, i: assert.strictEqual(notebookEditor.visibleRanges[notebookEditor.visibleRanges.length - 1].end, notebookEditor.notebook.cellCount, `Last cell is not visible`); }); + + test('Interactive window has the correct kernel', async () => { + assert.ok(vscode.workspace.workspaceFolders); + const notebookEditor = await createInteractiveWindow(defaultKernel); + assert.ok(notebookEditor); + + await vscode.commands.executeCommand('workbench.action.closeActiveEditor'); + + // Create a new interactive window with a different kernel + const notebookEditor2 = await createInteractiveWindow(secondKernel); + assert.ok(notebookEditor2); + + // Verify the kernel is the secondary one + await addCellAndRun(`print`, notebookEditor2.notebook, 0); + + assert.strictEqual(secondKernel.associatedNotebooks.has(notebookEditor2.notebook.uri.toString()), true, `Secondary kernel was not set as the kernel for the interactive window`); + + }); }); |