Skip to content

Commit 0ec1a1b

Browse files
committed
Fix tests
1 parent 5601a41 commit 0ec1a1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/datascience/interactiveWindowCommandListener.unit.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ suite('Interactive window command listener', async () => {
8080
const server = createTypeMoq<INotebookServer>('jupyter server');
8181
let lastFileContents: any;
8282

83-
setup(createCommandListener);
84-
8583
teardown(() => {
8684
documentManager.activeTextEditor = undefined;
8785
lastFileContents = undefined;
@@ -216,15 +214,18 @@ suite('Interactive window command listener', async () => {
216214
}
217215

218216
test('Import', async () => {
217+
createCommandListener();
219218
when(applicationShell.showOpenDialog(argThat(o => o.openLabel && o.openLabel.includes('Import')))).thenReturn(Promise.resolve([Uri.file('foo')]));
220219
await commandManager.executeCommand(Commands.ImportNotebook, undefined, undefined);
221220
assert.ok(documentManager.activeTextEditor, 'Imported file was not opened');
222221
});
223222
test('Import File', async () => {
223+
createCommandListener();
224224
await commandManager.executeCommand(Commands.ImportNotebook, Uri.file('bar.ipynb'), undefined);
225225
assert.ok(documentManager.activeTextEditor, 'Imported file was not opened');
226226
});
227227
test('Export File', async () => {
228+
createCommandListener();
228229
const doc = await documentManager.openTextDocument('bar.ipynb');
229230
await documentManager.showTextDocument(doc);
230231
when(applicationShell.showSaveDialog(argThat(o => o.saveLabel && o.saveLabel.includes('Export')))).thenReturn(Promise.resolve(Uri.file('foo')));
@@ -238,6 +239,7 @@ suite('Interactive window command listener', async () => {
238239
verify(applicationShell.showInformationMessage(anything(), localize.DataScience.exportOpenQuestion1(), localize.DataScience.exportOpenQuestion())).once();
239240
});
240241
test('Export File and output', async () => {
242+
createCommandListener();
241243
const doc = await documentManager.openTextDocument('bar.ipynb');
242244
await documentManager.showTextDocument(doc);
243245
when(jupyterExecution.connectToNotebookServer(anything(), anything())).thenResolve(server.object);
@@ -258,11 +260,13 @@ suite('Interactive window command listener', async () => {
258260
verify(applicationShell.showInformationMessage(anything(), localize.DataScience.exportOpenQuestion1(), localize.DataScience.exportOpenQuestion())).once();
259261
});
260262
test('Export skipped on no file', async () => {
263+
createCommandListener();
261264
when(applicationShell.showSaveDialog(argThat(o => o.saveLabel && o.saveLabel.includes('Export')))).thenReturn(Promise.resolve(Uri.file('foo')));
262265
await commandManager.executeCommand(Commands.ExportFileAndOutputAsNotebook, Uri.file('bar.ipynb'));
263266
assert.notExists(lastFileContents, 'Export file was written to');
264267
});
265268
test('Export happens on no file', async () => {
269+
createCommandListener();
266270
const doc = await documentManager.openTextDocument('bar.ipynb');
267271
await documentManager.showTextDocument(doc);
268272
when(applicationShell.showSaveDialog(argThat(o => o.saveLabel && o.saveLabel.includes('Export')))).thenReturn(Promise.resolve(Uri.file('foo')));

0 commit comments

Comments
 (0)