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
This commit is contained in:
Charles Gagnon
2019-03-29 10:25:52 -07:00
committed by GitHub
parent cb3cbd0d78
commit 37ce37979a

View File

@@ -63,17 +63,19 @@ if (context.RunTest) {
test('Clear all outputs - SQL notebook ', async function () { test('Clear all outputs - SQL notebook ', async function () {
let notebook = await openNotebook(sqlNotebookContent, sqlKernelMetadata); let notebook = await openNotebook(sqlNotebookContent, sqlKernelMetadata);
let cellWithOutputs = notebook.document.cells.find(cell => cell.contents && cell.contents.outputs && cell.contents.outputs.length > 0); 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) { if (cellWithOutputs) {
let clearedOutputs = await notebook.clearAllOutputs(); let clearedOutputs = await notebook.clearAllOutputs();
let cells = notebook.document.cells; let cells = notebook.document.cells;
cells.forEach(cell => { 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'); 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');
}); });