mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
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:
@@ -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');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user