瀏覽代碼

Fix more tests.

Jason Grout 5 年之前
父節點
當前提交
3ad329e240

+ 2 - 1
tests/test-console/src/foreign.spec.ts

@@ -21,7 +21,7 @@ import {
   defaultRenderMime,
   NBTestUtils
 } from '@jupyterlab/testutils';
-import { ISessionContext } from '@jupyterlab/apputils/src';
+import { ISessionContext } from '@jupyterlab/apputils';
 
 class TestParent extends Panel implements ForeignHandler.IReceiver {
   addCell(cell: CodeCell, msgId?: string): void {
@@ -108,6 +108,7 @@ describe('@jupyterlab/console', () => {
         createSessionContext({ path, type: 'test' }),
         createSession({ name: '', path, type: 'test' })
       ]);
+      await sessionContext.initialize();
       await sessionContext.kernel.info;
     });
 

+ 4 - 3
tests/test-console/src/panel.spec.ts

@@ -11,7 +11,7 @@ import { Widget } from '@phosphor/widgets';
 
 import { CodeConsole, ConsolePanel } from '@jupyterlab/console';
 
-import { dismissDialog } from '@jupyterlab/testutils';
+import { dismissDialog, acceptDialog } from '@jupyterlab/testutils';
 
 import {
   createConsolePanelFactory,
@@ -89,8 +89,9 @@ describe('console/panel', () => {
     describe('#onAfterAttach()', () => {
       it('should start the session', async () => {
         Widget.attach(panel, document.body);
-        await dismissDialog();
-        return panel.sessionContext.session.kernel.info;
+        await acceptDialog();
+        await panel.sessionContext.ready;
+        await panel.sessionContext.session.kernel.info;
       });
     });
 

+ 1 - 0
tests/test-docregistry/package.json

@@ -12,6 +12,7 @@
     "watch:src": "tsc -b --watch"
   },
   "dependencies": {
+    "@jupyterlab/apputils": "^2.0.0-alpha.1",
     "@jupyterlab/docregistry": "^2.0.0-alpha.1",
     "@jupyterlab/rendermime": "^2.0.0-alpha.1",
     "@jupyterlab/services": "^5.0.0-alpha.1",

+ 4 - 3
tests/test-docregistry/src/context.spec.ts

@@ -24,6 +24,7 @@ import {
   initNotebookContext,
   NBTestUtils
 } from '@jupyterlab/testutils';
+import { SessionContext } from '@jupyterlab/apputils';
 
 describe('docregistry/context', () => {
   let manager: ServiceManager.IManager;
@@ -231,9 +232,9 @@ describe('docregistry/context', () => {
       });
     });
 
-    describe('#session', () => {
-      it('should be a client session object', () => {
-        expect(context.sessionContext.session.path).to.equal(context.path);
+    describe('#sessionContext', () => {
+      it('should be a ISessionContext object', () => {
+        expect(context.sessionContext).to.be.instanceOf(SessionContext);
       });
     });
 

+ 3 - 0
tests/test-docregistry/tsconfig.json

@@ -8,6 +8,9 @@
   },
   "include": ["src/*"],
   "references": [
+    {
+      "path": "../../packages/apputils"
+    },
     {
       "path": "../../packages/docregistry"
     },

+ 4 - 1
tests/test-rendermime/src/registry.spec.ts

@@ -22,7 +22,10 @@ import {
   RenderMimeRegistry
 } from '@jupyterlab/rendermime';
 
-import { defaultRenderMime, createFileContext } from '@jupyterlab/testutils';
+import {
+  defaultRenderMime,
+  createFileContextWithKernel
+} from '@jupyterlab/testutils';
 
 function createModel(data: JSONObject): IRenderMime.IMimeModel {
   return new MimeModel({ data });