From 37ce37979ae9b4c038b300bba16210ac78c33c26 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 29 Mar 2019 10:25:52 -0700 Subject: [PATCH] Fix broken notebook test (#4766) * Fix broken test The test would always fail if it was doing the right thing - since it was asserting that there WEREN'T any cells with outputs (the opposite of what it should have been checking). * Update error message to be clearer * Fix spelling error --- extensions/integration-tests/src/notebook.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extensions/integration-tests/src/notebook.test.ts b/extensions/integration-tests/src/notebook.test.ts index 018e19eb04..a0287858ef 100644 --- a/extensions/integration-tests/src/notebook.test.ts +++ b/extensions/integration-tests/src/notebook.test.ts @@ -63,17 +63,19 @@ if (context.RunTest) { test('Clear all outputs - SQL notebook ', async function () { let notebook = await openNotebook(sqlNotebookContent, sqlKernelMetadata); let cellWithOutputs = notebook.document.cells.find(cell => cell.contents && cell.contents.outputs && cell.contents.outputs.length > 0); - console.log("Before clearing cell outputs"); + console.log('Before clearing cell outputs'); if (cellWithOutputs) { let clearedOutputs = await notebook.clearAllOutputs(); let cells = notebook.document.cells; cells.forEach(cell => { - assert(cell.contents && cell.contents.outputs && cell.contents.outputs.length === 0, `Expected Output: 0, Acutal: '${cell.contents.outputs.length}'`); + assert(cell.contents && cell.contents.outputs && cell.contents.outputs.length === 0, `Expected cell outputs to be empty. Actual: '${cell.contents.outputs}'`); }); assert(clearedOutputs, 'Outputs of all the code cells from SQL notebook should be cleared'); - console.log("After clearing cell outputs"); + console.log('After clearing cell outputs'); + } + else { + throw new Error('Could not find notebook cells with outputs'); } - assert(cellWithOutputs === undefined, 'Could not find notebook cells with outputs'); });