Files
vscode/extensions/vscode-api-tests/src/singlefolder-tests/ipynb.test.ts
Rob Lourens bb79477f2e Enable ipynb serializer tests in web integration tests
and reenable NotebookSerializer test in non-web
2022-02-01 18:22:57 -08:00

27 lines
1.3 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import 'mocha';
import * as vscode from 'vscode';
(vscode.env.uiKind === vscode.UIKind.Web ? suite.skip : suite)('ipynb NotebookSerializer', function () {
test('Can open an ipynb notebook', async () => {
assert.ok(vscode.workspace.workspaceFolders);
const workspace = vscode.workspace.workspaceFolders[0];
const uri = vscode.Uri.joinPath(workspace.uri, 'test.ipynb');
const notebook = await vscode.workspace.openNotebookDocument(uri);
await vscode.window.showNotebookDocument(notebook);
const notebookEditor = vscode.window.activeNotebookEditor;
assert.ok(notebookEditor);
assert.strictEqual(notebookEditor.document.cellCount, 2);
assert.strictEqual(notebookEditor.document.cellAt(0).kind, vscode.NotebookCellKind.Markup);
assert.strictEqual(notebookEditor.document.cellAt(1).kind, vscode.NotebookCellKind.Code);
assert.strictEqual(notebookEditor.document.cellAt(1).outputs.length, 1);
});
});