Skip to content

Commit 4f48157

Browse files
Address PR feedback: use Uri.joinPath, assert exact cell count, extract dynamic import helper
Co-Authored-By: Filip Pyrek <PyrekFilip@gmail.com>
1 parent bfb141d commit 4f48157

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/notebooks/deepnote/deepnoteExplorerView.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export class DeepnoteExplorerView {
356356
const outputFileName = `${projectName}.deepnote`;
357357
const outputPath = Uri.joinPath(workspaceFolder.uri, outputFileName).path;
358358

359-
const { convertIpynbFilesToDeepnoteFile } = await import('@deepnote/convert');
359+
const convertIpynbFilesToDeepnoteFile = await this.getConverter();
360360
await convertIpynbFilesToDeepnoteFile(inputFilePaths, {
361361
outputPath: outputPath,
362362
projectName: projectName
@@ -379,6 +379,11 @@ export class DeepnoteExplorerView {
379379
}
380380
}
381381

382+
private async getConverter() {
383+
const { convertIpynbFilesToDeepnoteFile } = await import('@deepnote/convert');
384+
return convertIpynbFilesToDeepnoteFile;
385+
}
386+
382387
private async importJupyterNotebook(): Promise<void> {
383388
if (!workspace.workspaceFolders || workspace.workspaceFolders.length === 0) {
384389
const selection = await window.showInformationMessage(
@@ -429,7 +434,7 @@ export class DeepnoteExplorerView {
429434
// File doesn't exist, continue
430435
}
431436

432-
const { convertIpynbFilesToDeepnoteFile } = await import('@deepnote/convert');
437+
const convertIpynbFilesToDeepnoteFile = await this.getConverter();
433438
await convertIpynbFilesToDeepnoteFile(inputFilePaths, {
434439
outputPath: outputUri.path,
435440
projectName: projectName

src/test/datascience/notebook/deepnote.vscode.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
22
import { assert } from 'chai';
3-
import * as path from '../../../platform/vscode-path/path';
43
import { Uri, workspace } from 'vscode';
54
import { IDisposable } from '../../../platform/common/types';
65
import { captureScreenShot, IExtensionTestApi } from '../../common.node';
@@ -13,8 +12,13 @@ import { IDeepnoteNotebookManager } from '../../../notebooks/types';
1312
suite('Deepnote Integration Tests @kernelCore', function () {
1413
let api: IExtensionTestApi;
1514
const disposables: IDisposable[] = [];
16-
const deepnoteFilePath = Uri.file(
17-
path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'src', 'test', 'datascience', 'notebook', 'test.deepnote')
15+
const deepnoteFilePath = Uri.joinPath(
16+
Uri.file(EXTENSION_ROOT_DIR_FOR_TESTS),
17+
'src',
18+
'test',
19+
'datascience',
20+
'notebook',
21+
'test.deepnote'
1822
);
1923
this.timeout(240_000);
2024

@@ -57,7 +61,7 @@ suite('Deepnote Integration Tests @kernelCore', function () {
5761
logger.debug(`Opened notebook with type: ${nbDocument.notebookType}, cells: ${nbDocument.cellCount}`);
5862

5963
assert.equal(nbDocument.notebookType, 'deepnote', 'Notebook type should be deepnote');
60-
assert.isTrue(nbDocument.cellCount > 0, 'Notebook should have cells');
64+
assert.equal(nbDocument.cellCount, 3, 'Notebook should have 3 cells');
6165

6266
assert.equal(nbDocument.metadata?.deepnoteProjectId, 'test-project-id', 'Project ID should match');
6367
assert.equal(nbDocument.metadata?.deepnoteNotebookId, 'main-notebook-id', 'Notebook ID should match');

0 commit comments

Comments
 (0)