Add Cell after current active cell (#10203)

* Add Cell after current active cell

* fixed error

* more fixes

* Addressed PR

* merged with master

* Fixed the tests and code

* removed try catch and modified the test to check the method does not throw.

Co-authored-by: Rajesh Kamath <rajkashop@hotmail.com>
This commit is contained in:
rajeshka
2020-05-06 11:42:01 -07:00
committed by GitHub
parent 9b296c9f42
commit 4199cec393
2 changed files with 15 additions and 12 deletions

View File

@@ -26,17 +26,16 @@ suite('Notebook Actions', function (): void {
// Normal use case
let mockNotebookComponent = TypeMoq.Mock.ofType<INotebookEditor>(NotebookComponentStub);
mockNotebookComponent.setup(c => c.addCell(TypeMoq.It.isAny())).returns(cellType => {
mockNotebookComponent.setup(c => c.addCell(TypeMoq.It.isAny(), TypeMoq.It.isAnyNumber())).returns(cellType => {
actualCellType = cellType;
});
let result = await action.run(mockNotebookComponent.object);
assert.ok(result, 'Add Cell Action should succeed');
assert.doesNotThrow(() => action.run(mockNotebookComponent.object));
assert.strictEqual(actualCellType, testCellType);
// Handle error case
mockNotebookComponent.reset();
mockNotebookComponent.setup(c => c.addCell(TypeMoq.It.isAny())).throws(new Error('Test Error'));
mockNotebookComponent.setup(c => c.addCell(TypeMoq.It.isAny(), TypeMoq.It.isAnyNumber())).throws(new Error('Test Error'));
await assert.rejects(action.run(mockNotebookComponent.object));
});