mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 01:25:37 -05:00
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:
@@ -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));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user