Skip to content

Commit b70bcec

Browse files
committed
fix: Fix tests mocks
Signed-off-by: Tomas Kislan <[email protected]>
1 parent 80b7492 commit b70bcec

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

src/notebooks/deepnote/deepnoteNotebookCommandListener.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class DeepnoteNotebookCommandListener implements IExtensionSyncActivation
213213
}
214214

215215
const notebookRange = new NotebookRange(insertIndex, insertIndex + 1);
216-
editor.revealRange(notebookRange, NotebookEditorRevealType?.Default ?? 0);
216+
editor.revealRange(notebookRange, NotebookEditorRevealType.Default);
217217
editor.selection = notebookRange;
218218
// Enter edit mode on the new cell
219219
await commands.executeCommand('notebook.cell.edit');
@@ -254,7 +254,7 @@ export class DeepnoteNotebookCommandListener implements IExtensionSyncActivation
254254
}
255255

256256
const notebookRange = new NotebookRange(insertIndex, insertIndex + 1);
257-
editor.revealRange(notebookRange, NotebookEditorRevealType?.Default ?? 0);
257+
editor.revealRange(notebookRange, NotebookEditorRevealType.Default);
258258
editor.selection = notebookRange;
259259
// Enter edit mode on the new cell
260260
await commands.executeCommand('notebook.cell.edit');
@@ -298,8 +298,7 @@ export class DeepnoteNotebookCommandListener implements IExtensionSyncActivation
298298
}
299299

300300
const notebookRange = new NotebookRange(insertIndex, insertIndex + 1);
301-
// editor.revealRange(notebookRange, NotebookEditorRevealType.Default);
302-
editor.revealRange(notebookRange, 0);
301+
editor.revealRange(notebookRange, NotebookEditorRevealType.Default);
303302
editor.selection = notebookRange;
304303
// Enter edit mode on the new cell
305304
await commands.executeCommand('notebook.cell.edit');

src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { assert } from 'chai';
22
import * as sinon from 'sinon';
3-
import {
4-
DeepnoteNotebookCommandListener,
5-
getNextDeepnoteVariableName,
6-
InputBlockType
7-
} from './deepnoteNotebookCommandListener';
8-
import { IDisposable } from '../../platform/common/types';
93
import {
104
NotebookCell,
115
NotebookDocument,
@@ -18,6 +12,13 @@ import {
1812
window,
1913
Uri
2014
} from 'vscode';
15+
16+
import {
17+
DeepnoteNotebookCommandListener,
18+
getNextDeepnoteVariableName,
19+
InputBlockType
20+
} from './deepnoteNotebookCommandListener';
21+
import { IDisposable } from '../../platform/common/types';
2122
import * as notebookUpdater from '../../kernels/execution/notebookUpdater';
2223
import { createMockedNotebookDocument } from '../../test/datascience/editor-integration/helpers';
2324

src/test/mocks/vsc/extHostedTypes.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,6 +2406,29 @@ export namespace vscMockExtHostedTypes {
24062406
}
24072407
}
24082408

2409+
/**
2410+
* Notebook editor reveal type.
2411+
*/
2412+
export enum NotebookEditorRevealType {
2413+
/**
2414+
* The range will be revealed with as little scrolling as possible.
2415+
*/
2416+
Default = 0,
2417+
/**
2418+
* The range will always be revealed in the center of the viewport.
2419+
*/
2420+
InCenter = 1,
2421+
/**
2422+
* If the range is outside the viewport, it will be revealed in the center of the viewport.
2423+
* Otherwise, it will be revealed with as little scrolling as possible.
2424+
*/
2425+
InCenterIfOutsideViewport = 2,
2426+
/**
2427+
* The range will always be revealed at the top of the viewport.
2428+
*/
2429+
AtTop = 3
2430+
}
2431+
24092432
/**
24102433
* A notebook range represents an ordered pair of two cell indices.
24112434
* It is guaranteed that start is less than or equal to end.

src/test/vscode-mock.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,4 @@ mockedVSCode.QuickPickItemKind = vscodeMocks.vscMockExtHostedTypes.QuickPickItem
195195
mockedVSCode.NotebookCellOutput = vscodeMocks.vscMockExtHostedTypes.NotebookCellOutput;
196196
(mockedVSCode as any).NotebookCellOutputItem = vscodeMocks.vscMockExtHostedTypes.NotebookCellOutputItem;
197197
(mockedVSCode as any).NotebookCellExecutionState = vscodeMocks.vscMockExtHostedTypes.NotebookCellExecutionState;
198+
(mockedVSCode as any).NotebookEditorRevealType = vscodeMocks.vscMockExtHostedTypes.NotebookEditorRevealType;

0 commit comments

Comments
 (0)