浏览代码

Add test for DebugService.modelChanged

Jeremy Tuloup 5 年之前
父节点
当前提交
5fac817560
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 17 1
      tests/src/service.spec.ts

+ 17 - 1
tests/src/service.spec.ts

@@ -4,6 +4,8 @@ import { ClientSession, IClientSession } from '@jupyterlab/apputils';
 
 import { createClientSession } from '@jupyterlab/testutils';
 
+import { Debugger } from '../../lib/debugger';
+
 import { DebugService } from '../../lib/service';
 
 import { DebugSession } from '../../lib/session';
@@ -12,6 +14,7 @@ import { IDebugger } from '../../lib/tokens';
 
 describe('DebugService', () => {
   let client: IClientSession;
+  let model: Debugger.Model;
   let session: IDebugger.ISession;
   let service: IDebugger;
 
@@ -24,6 +27,7 @@ describe('DebugService', () => {
     await (client as ClientSession).initialize();
     await client.kernel.ready;
     session = new DebugSession({ client });
+    model = new Debugger.Model({});
     service = new DebugService();
   });
 
@@ -65,7 +69,7 @@ describe('DebugService', () => {
   });
 
   describe('#session', () => {
-    it('should emit the sessionChanged event setting the session', () => {
+    it('should emit the sessionChanged signal when setting the session', () => {
       let sessionChangedEvents: IDebugger.ISession[] = [];
       service.sessionChanged.connect((_, newSession) => {
         sessionChangedEvents.push(newSession);
@@ -75,4 +79,16 @@ describe('DebugService', () => {
       expect(sessionChangedEvents[0]).to.eq(session);
     });
   });
+
+  describe('#model', () => {
+    it('should emit the modelChanged signal when setting the model', () => {
+      let modelChangedEvents: Debugger.Model[] = [];
+      service.modelChanged.connect((_, newModel) => {
+        modelChangedEvents.push(newModel);
+      });
+      service.model = model;
+      expect(modelChangedEvents.length).to.equal(1);
+      expect(modelChangedEvents[0]).to.eq(model);
+    });
+  });
 });