mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 17:22:51 -05:00
New tests for NotebookServiceImpl module (#11250)
* Working tests Upto 97.5% coverage * pr feedback * pr feedback * pr feedback and test bug fixes + 1 new test * revert debug change
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { QueryTextEditor } from 'sql/workbench/browser/modelComponents/queryTextEditor';
|
||||
import * as stubs from 'sql/workbench/contrib/notebook/test/stubs';
|
||||
import { INotebookModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { INotebookParams } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
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';
|
||||
@@ -18,20 +19,21 @@ import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServic
|
||||
// Leave both undefined when you want the underlying object(s) to have an undefined editor.
|
||||
export class NotebookEditorStub extends stubs.NotebookEditorStub {
|
||||
cellEditors: CellEditorProviderStub[];
|
||||
private _model: INotebookModel | undefined;
|
||||
model: INotebookModel | undefined;
|
||||
|
||||
get model(): INotebookModel | undefined {
|
||||
return this._model;
|
||||
get id(): string {
|
||||
return this.notebookParams?.notebookUri?.toString();
|
||||
}
|
||||
|
||||
get modelReady(): Promise<INotebookModel> {
|
||||
return Promise.resolve(this._model);
|
||||
return Promise.resolve(this.model);
|
||||
}
|
||||
|
||||
// Normally one needs to provide either the editor or the instantiationService as the constructor parameter
|
||||
constructor({ cellGuid, instantiationService, editor, model }: { cellGuid?: string; instantiationService?: IInstantiationService; editor?: QueryTextEditor; model?: INotebookModel } = {}) {
|
||||
constructor({ cellGuid, instantiationService, editor, model, notebookParams }: { cellGuid?: string; instantiationService?: IInstantiationService; editor?: QueryTextEditor; model?: INotebookModel, notebookParams?: INotebookParams } = {}) {
|
||||
super();
|
||||
this._model = model;
|
||||
this.model = model;
|
||||
this.notebookParams = notebookParams;
|
||||
this.cellEditors = [new CellEditorProviderStub({ cellGuid: cellGuid, instantiationService: instantiationService, editor: editor })];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user