mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-04-01 09:30:31 -04:00
Integrate first SQL Notebooks Bits into Master (#3679)
* First crack tsql notebook (no output rendered yet) * getting messages back * intellisense working first cell, no connection errors * sql notebook cell output functioning * Latest SQL noteobook changes * Undo change to launch.json * Plumbing providers through * Kernels shown from multiple providers, can switch between them. No mementos yet * Ensure we have a feature flag for SQL notebooks, ensure existing functionality still works * Fix tslint duplicate imports issue * Addressing PR comments * second round of PR feedback to cleanup notebook service manager code * merge latest from master
This commit is contained in:
@@ -73,7 +73,7 @@ let mockModelFactory: TypeMoq.Mock<ModelFactory>;
|
||||
let notificationService: TypeMoq.Mock<INotificationService>;
|
||||
|
||||
describe('notebook model', function(): void {
|
||||
let notebookManager = new NotebookManagerStub();
|
||||
let notebookManagers = [new NotebookManagerStub()];
|
||||
let memento: TypeMoq.Mock<Memento>;
|
||||
let queryConnectionService: TypeMoq.Mock<ConnectionManagementService>;
|
||||
let defaultModelOptions: INotebookModelOptions;
|
||||
@@ -87,9 +87,10 @@ describe('notebook model', function(): void {
|
||||
defaultModelOptions = {
|
||||
notebookUri: defaultUri,
|
||||
factory: new ModelFactory(),
|
||||
notebookManager,
|
||||
notebookManagers,
|
||||
notificationService: notificationService.object,
|
||||
connectionService: queryConnectionService.object };
|
||||
connectionService: queryConnectionService.object,
|
||||
providerId: 'jupyter' };
|
||||
mockClientSession = TypeMoq.Mock.ofType(ClientSession, undefined, defaultModelOptions);
|
||||
mockClientSession.setup(c => c.initialize(TypeMoq.It.isAny())).returns(() => {
|
||||
return Promise.resolve();
|
||||
@@ -118,7 +119,7 @@ describe('notebook model', function(): void {
|
||||
|
||||
let mockContentManager = TypeMoq.Mock.ofType(LocalContentManager);
|
||||
mockContentManager.setup(c => c.getNotebookContents(TypeMoq.It.isAny())).returns(() => Promise.resolve(emptyNotebook));
|
||||
notebookManager.contentManager = mockContentManager.object;
|
||||
notebookManagers[0].contentManager = mockContentManager.object;
|
||||
|
||||
// When I initialize the model
|
||||
let model = new NotebookModel(defaultModelOptions);
|
||||
@@ -134,7 +135,7 @@ describe('notebook model', function(): void {
|
||||
let error = new Error('File not found');
|
||||
let mockContentManager = TypeMoq.Mock.ofType(LocalContentManager);
|
||||
mockContentManager.setup(c => c.getNotebookContents(TypeMoq.It.isAny())).throws(error);
|
||||
notebookManager.contentManager = mockContentManager.object;
|
||||
notebookManagers[0].contentManager = mockContentManager.object;
|
||||
|
||||
// When I initalize the model
|
||||
// Then it should throw
|
||||
@@ -148,7 +149,7 @@ describe('notebook model', function(): void {
|
||||
// Given a notebook with 2 cells
|
||||
let mockContentManager = TypeMoq.Mock.ofType(LocalContentManager);
|
||||
mockContentManager.setup(c => c.getNotebookContents(TypeMoq.It.isAny())).returns(() => Promise.resolve(expectedNotebookContent));
|
||||
notebookManager.contentManager = mockContentManager.object;
|
||||
notebookManagers[0].contentManager = mockContentManager.object;
|
||||
|
||||
// When I initalize the model
|
||||
let model = new NotebookModel(defaultModelOptions);
|
||||
@@ -163,7 +164,7 @@ describe('notebook model', function(): void {
|
||||
it('Should load contents but then go to error state if client session startup fails', async function(): Promise<void> {
|
||||
let mockContentManager = TypeMoq.Mock.ofType(LocalContentManager);
|
||||
mockContentManager.setup(c => c.getNotebookContents(TypeMoq.It.isAny())).returns(() => Promise.resolve(expectedNotebookContentOneCell));
|
||||
notebookManager.contentManager = mockContentManager.object;
|
||||
notebookManagers[0].contentManager = mockContentManager.object;
|
||||
|
||||
// Given I have a session that fails to start
|
||||
mockClientSession.setup(c => c.isInErrorState).returns(() => true);
|
||||
@@ -192,7 +193,7 @@ describe('notebook model', function(): void {
|
||||
it('Should not be in error state if client session initialization succeeds', async function(): Promise<void> {
|
||||
let mockContentManager = TypeMoq.Mock.ofType(LocalContentManager);
|
||||
mockContentManager.setup(c => c.getNotebookContents(TypeMoq.It.isAny())).returns(() => Promise.resolve(expectedNotebookContentOneCell));
|
||||
notebookManager.contentManager = mockContentManager.object;
|
||||
notebookManagers[0].contentManager = mockContentManager.object;
|
||||
let kernelChangedEmitter: Emitter<nb.IKernelChangedArgs> = new Emitter<nb.IKernelChangedArgs>();
|
||||
|
||||
mockClientSession.setup(c => c.isInErrorState).returns(() => false);
|
||||
|
||||
Reference in New Issue
Block a user