Ensure that we close editors before utils tests (#13391)

This commit is contained in:
Chris LaFreniere
2020-11-13 11:16:14 -08:00
committed by GitHub
parent cbe2ba0901
commit 6b657259a5
2 changed files with 8 additions and 4 deletions

View File

@@ -20,14 +20,18 @@ describe('notebookUtils Tests', function (): void {
let notebookUtils: NotebookUtils = new NotebookUtils();
let showErrorMessageSpy: sinon.SinonSpy;
beforeEach(function(): void {
beforeEach(function (): void {
showErrorMessageSpy = sinon.spy(vscode.window, 'showErrorMessage');
});
afterEach(function(): void {
afterEach(function (): void {
sinon.restore();
});
this.beforeAll(async function (): Promise<void> {
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
this.afterAll(async function (): Promise<void> {
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
@@ -109,7 +113,7 @@ describe('notebookUtils Tests', function (): void {
sinon.replaceGetter(azdata.nb, 'activeNotebookEditor', () => undefined);
await notebookUtils.clearActiveCellOutput();
should(showErrorMessageSpy.calledOnce).be.true('showErrorMessage should be called exactly once');
});
});
it('does not show error when notebook visible', async function (): Promise<void> {
let mockNotebookEditor = TypeMoq.Mock.ofType<azdata.nb.NotebookEditor>();