|
@@ -25,9 +25,9 @@ describe('docregistry/context', () => {
|
|
|
let manager: ServiceManager.IManager;
|
|
|
let factory = new TextModelFactory();
|
|
|
|
|
|
- before((done) => {
|
|
|
+ before(() => {
|
|
|
manager = new ServiceManager();
|
|
|
- manager.ready.then(done, done);
|
|
|
+ return manager.ready;
|
|
|
});
|
|
|
|
|
|
describe('Context', () => {
|
|
@@ -39,9 +39,9 @@ describe('docregistry/context', () => {
|
|
|
});
|
|
|
|
|
|
afterEach((done) => {
|
|
|
- if (context.kernel) {
|
|
|
- context.kernel.ready.then(() => {
|
|
|
- return context.changeKernel(null);
|
|
|
+ if (context.session.kernel) {
|
|
|
+ context.session.kernel.ready.then(() => {
|
|
|
+ return context.session.shutdown();
|
|
|
}).then(() => {
|
|
|
context.dispose();
|
|
|
}).then(done, done);
|
|
@@ -60,20 +60,6 @@ describe('docregistry/context', () => {
|
|
|
|
|
|
});
|
|
|
|
|
|
- describe('#kernelChanged', () => {
|
|
|
-
|
|
|
- it('should be emitted when the kernel changes', (done) => {
|
|
|
- let name = manager.specs.default;
|
|
|
- context.kernelChanged.connect((sender, args) => {
|
|
|
- expect(sender).to.be(context);
|
|
|
- expect(args.name).to.be(name);
|
|
|
- done();
|
|
|
- });
|
|
|
- context.changeKernel({ name });
|
|
|
- });
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
describe('#pathChanged', () => {
|
|
|
|
|
|
it('should be emitted when the path changes', (done) => {
|
|
@@ -155,18 +141,10 @@ describe('docregistry/context', () => {
|
|
|
|
|
|
});
|
|
|
|
|
|
- describe('#kernel', () => {
|
|
|
+ describe('#session', () => {
|
|
|
|
|
|
- it('should default to `null`', () => {
|
|
|
- expect(context.kernel).to.be(null);
|
|
|
- });
|
|
|
-
|
|
|
- it('should be set after switching kernels', (done) => {
|
|
|
- let name = manager.specs.default;
|
|
|
- context.changeKernel({ name }).then(() => {
|
|
|
- expect(context.kernel.name).to.be(name);
|
|
|
- done();
|
|
|
- }).catch(done);
|
|
|
+ it('should be a client session object', () => {
|
|
|
+ expect(context.session.path).to.be(context.path);
|
|
|
});
|
|
|
|
|
|
});
|
|
@@ -224,43 +202,6 @@ describe('docregistry/context', () => {
|
|
|
|
|
|
});
|
|
|
|
|
|
- describe('#startDefaultKernel()', () => {
|
|
|
-
|
|
|
- it('should start the default kernel for the context', (done) => {
|
|
|
- context.save().then(() => {
|
|
|
- return context.startDefaultKernel();
|
|
|
- }).then(kernel => {
|
|
|
- expect(kernel.name).to.be.ok();
|
|
|
- done();
|
|
|
- }).catch(done);
|
|
|
- });
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- describe('#changeKernel()', () => {
|
|
|
-
|
|
|
- it('should change the kernel instance', (done) => {
|
|
|
- let name = manager.specs.default;
|
|
|
- context.changeKernel({ name }).then(() => {
|
|
|
- expect(context.kernel.name).to.be(name);
|
|
|
- }).then(done, done);
|
|
|
- });
|
|
|
-
|
|
|
- it('should shut down the session if given `null`', (done) => {
|
|
|
- let name = manager.specs.default;
|
|
|
- context.changeKernel({ name }).then(() => {
|
|
|
- expect(context.kernel.name).to.be(name);
|
|
|
- return context.kernel.ready;
|
|
|
- }).then(() => {
|
|
|
- return context.changeKernel(null);
|
|
|
- }).then(() => {
|
|
|
- expect(context.kernel).to.be(null);
|
|
|
- done();
|
|
|
- }).catch(done);
|
|
|
- });
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
describe('#save()', () => {
|
|
|
|
|
|
it('should save the contents of the file to disk', (done) => {
|