Browse Source

Update tests for services 0.20

Steven Silvester 8 years ago
parent
commit
99b32c875e

+ 2 - 2
test/src/completer/handler.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  KernelMessage, IKernel, startNewKernel
+  KernelMessage, IKernel, Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -69,7 +69,7 @@ class TestCompleterHandler extends CellCompleterHandler {
   }
 }
 
-const kernelPromise = startNewKernel();
+const kernelPromise = Kernel.startNew();
 
 
 describe('completer/handler', () => {

+ 2 - 2
test/src/console/history.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  KernelMessage, IKernel, startNewKernel
+  KernelMessage, IKernel, Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -36,7 +36,7 @@ class TestHistory extends ConsoleHistory {
 }
 
 
-const kernelPromise = startNewKernel();
+const kernelPromise = Kernel.startNew();
 
 
 describe('console/history', () => {

+ 2 - 2
test/src/docregistry/default.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  IKernel
+  Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -27,7 +27,7 @@ import {
 
 class WidgetFactory extends ABCWidgetFactory<Widget, IDocumentModel> {
 
-  createNew(context: IDocumentContext<IDocumentModel>, kernel?: IKernel.IModel): Widget {
+  createNew(context: IDocumentContext<IDocumentModel>, kernel?: Kernel.IModel): Widget {
     return new Widget();
   }
 }

+ 2 - 2
test/src/docregistry/registry.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  IKernel
+  Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -23,7 +23,7 @@ import {
 
 class WidgetFactory extends ABCWidgetFactory<Widget, IDocumentModel> {
 
-  createNew(context: IDocumentContext<IDocumentModel>, kernel?: IKernel.IModel): Widget {
+  createNew(context: IDocumentContext<IDocumentModel>, kernel?: Kernel.IModel): Widget {
     return new Widget();
   }
 }

+ 3 - 3
test/src/notebook/cells/widget.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  startNewKernel
+  Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -584,7 +584,7 @@ describe('notebook/cells/widget', () => {
 
       it('should fulfill a promise if there is no code to execute', (done) => {
         let widget = new CodeCellWidget({ rendermime, renderer: CodeMirrorNotebookRenderer.defaultCodeCellRenderer });
-        startNewKernel().then(kernel => {
+        Kernel.startNew().then(kernel => {
           widget.model = new CodeCellModel();
           return widget.execute(kernel).then(() => {
             kernel.shutdown();
@@ -595,7 +595,7 @@ describe('notebook/cells/widget', () => {
 
       it('should fulfill a promise if there is code to execute', (done) => {
         let widget = new CodeCellWidget({ rendermime, renderer: CodeMirrorNotebookRenderer.defaultCodeCellRenderer });
-        startNewKernel().then(kernel => {
+        Kernel.startNew().then(kernel => {
           widget.model = new CodeCellModel();
           widget.model.source = 'foo';
 

+ 2 - 2
test/src/notebook/notebook/actions.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  IKernel, startNewKernel
+  IKernel, Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -42,7 +42,7 @@ import {
 
 const clipboard = new MimeData();
 const ERROR_INPUT = 'a = foo';
-const kernelPromise = startNewKernel();
+const kernelPromise = Kernel.startNew();
 
 
 describe('notebook/notebook/actions', () => {

+ 5 - 5
test/src/notebook/notebook/default-toolbar.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  utils, startNewSession
+  utils, Session
 } from 'jupyter-js-services';
 
 import {
@@ -64,7 +64,7 @@ import {
  */
 const rendermime = defaultRenderMime();
 const clipboard = new MimeData();
-const sessionPromise = startNewSession({ path: utils.uuid() });
+const sessionPromise = Session.startNew({ path: utils.uuid() });
 
 
 describe('notebook/notebook/default-toolbar', () => {
@@ -309,7 +309,7 @@ describe('notebook/notebook/default-toolbar', () => {
     describe('#createKernelNameItem()', () => {
 
       it('should display the `\'display_name\'` of the kernel', (done) => {
-        return panel.kernel.getKernelSpec().then(spec => {
+        return panel.kernel.getSpec().then(spec => {
           let item = createKernelNameItem(panel);
           expect(item.node.textContent).to.be(spec.display_name);
           done();
@@ -326,7 +326,7 @@ describe('notebook/notebook/default-toolbar', () => {
         let item = createKernelNameItem(panel);
         let name = context.kernelspecs.default;
         panel.context.changeKernel({ name }).then(kernel => {
-          return kernel.getKernelSpec().then(spec => {
+          return kernel.getSpec().then(spec => {
             expect(item.node.textContent).to.be(spec.display_name);
             done();
           });
@@ -335,7 +335,7 @@ describe('notebook/notebook/default-toolbar', () => {
 
       it('should handle a change in context', (done) => {
         let item = createKernelNameItem(panel);
-        panel.kernel.getKernelSpec().then(spec => {
+        panel.kernel.getSpec().then(spec => {
           panel.context = null;
           expect(item.node.textContent).to.be('No Kernel!');
         }).then(done, done);

+ 2 - 2
test/src/notebook/output-area/model.spec.ts

@@ -4,7 +4,7 @@
 import expect = require('expect.js');
 
 import {
-  IKernel, startNewKernel
+  IKernel, Kernel
 } from 'jupyter-js-services';
 
 import {
@@ -206,7 +206,7 @@ describe('notebook/output-area/model', () => {
       let kernel: IKernel;
 
       beforeEach((done) => {
-        startNewKernel().then(k => {
+        Kernel.startNew().then(k => {
           kernel = k;
           return kernel.kernelInfo();
         }).then(() => {

+ 0 - 4
test/src/typings.d.ts

@@ -2,7 +2,3 @@
 /// <reference types="expect.js" />
 /// <reference types="typescript" />
 /// <reference types="mocha" />
-/// <reference types="requirejs" />
-
-// For a Thenable reference in jupyter-js-services
-type Thenable<T> = Promise<T>