mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -05:00
Second batch of tests for notebookEditor class (#10999)
* first few notebookEditor tests * formating fixes * unstash previous unfinished work * saving * PR feedback * PR feedback * copyright fixes * improve test names and assertion messages * saving * PR feedback * improve test names. * test name change * test name change * remove unneeded cast * remove spurious comment * fix misplaced paranthesis - thanks hygiene checker! * remove unused code * remove deferredPromise * createEditor test and dispose fixes * remove unneeded import * rempve unnecessary mock usage in dispose test * use getContainer() for ['parent'] * use getContainer for ['parent'] * remove launch.json edits * notebookService needs 9th constructor argument * Add uploading debugging step * minor changes * remove changes to ci.yml * working version * formatting fixes * pr fixes * hygiene and exception path fixes * remove minor debug changes * pr feedback * pr feedback Co-authored-by: Arvind Ranasaria MacPro <arvranmac@MININT-OE7B592.fareast.corp.microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { QueryTextEditor } from 'sql/workbench/browser/modelComponents/queryTextEditor';
|
||||
import { CellEditorProviderStub, NotebookEditorStub } from 'sql/workbench/contrib/notebook/test/stubs';
|
||||
import * as stubs from 'sql/workbench/contrib/notebook/test/stubs';
|
||||
import { INotebookModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -15,18 +16,29 @@ import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServic
|
||||
|
||||
// Typically you will pass in either editor or the instantiationService parameter.
|
||||
// Leave both undefined when you want the underlying object(s) to have an undefined editor.
|
||||
export class TestNotebookEditor extends NotebookEditorStub {
|
||||
export class NotebookEditorStub extends stubs.NotebookEditorStub {
|
||||
cellEditors: CellEditorProviderStub[];
|
||||
private _model: INotebookModel | undefined;
|
||||
|
||||
get model(): INotebookModel | undefined {
|
||||
return this._model;
|
||||
}
|
||||
|
||||
get modelReady(): Promise<INotebookModel> {
|
||||
return Promise.resolve(this._model);
|
||||
}
|
||||
|
||||
// Normally one needs to provide either the editor or the instantiationService as the constructor parameter
|
||||
constructor({ cellGuid, instantiationService, editor }: { cellGuid?: string; instantiationService?: IInstantiationService; editor?: QueryTextEditor; } = {}) {
|
||||
constructor({ cellGuid, instantiationService, editor, model }: { cellGuid?: string; instantiationService?: IInstantiationService; editor?: QueryTextEditor; model?: INotebookModel } = {}) {
|
||||
super();
|
||||
this.cellEditors = [new TestCellEditorProvider({ cellGuid: cellGuid, instantiationService: instantiationService, editor: editor })];
|
||||
this._model = model;
|
||||
this.cellEditors = [new CellEditorProviderStub({ cellGuid: cellGuid, instantiationService: instantiationService, editor: editor })];
|
||||
}
|
||||
}
|
||||
|
||||
// Typically you will pass in either editor or the instantiationService parameter.
|
||||
// Leave both undefined when you want the underlying object to have an undefined editor.
|
||||
class TestCellEditorProvider extends CellEditorProviderStub {
|
||||
class CellEditorProviderStub extends stubs.CellEditorProviderStub {
|
||||
private _editor: QueryTextEditor;
|
||||
private _cellGuid: string;
|
||||
constructor({ cellGuid, instantiationService, editor }: { cellGuid: string; instantiationService?: IInstantiationService; editor?: QueryTextEditor; }) {
|
||||
|
||||
Reference in New Issue
Block a user