Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should accept server settings', () => {
const serverSettings = makeSettings();
const session = Session.connectTo(defaultSession.model, serverSettings);
expect(session.id).to.be.ok;
});
});
it('should connect to a running session', () => {
const newSession = Session.connectTo(defaultSession.model);
expect(newSession.id).to.equal(defaultSession.id);
expect(newSession.kernel.id).to.equal(defaultSession.kernel.id);
expect(newSession).to.not.equal(defaultSession);
expect(newSession.kernel).to.not.equal(defaultSession.kernel);
});
it('should dispose of all session instances', async () => {
const session0 = await startNew();
const session1 = Session.connectTo(session0.model);
await session0.shutdown();
expect(session1.isDisposed).to.equal(true);
});
});
it('should fail if the session is disposed', async () => {
const session = Session.connectTo(defaultSession.model);
session.dispose();
const promise = session.setPath(UUID.uuid4());
await expectFailure(promise, 'Session is disposed');
});
});
it('should dispose of all session instances', async () => {
const session0 = await startNew();
const session1 = Session.connectTo(session0.model);
await session0.shutdown();
expect(session1.isDisposed).to.equal(true);
});
});
it('should be true after we dispose of the session', () => {
const session = Session.connectTo(defaultSession.model);
expect(session.isDisposed).to.equal(false);
session.dispose();
expect(session.isDisposed).to.equal(true);
});
it('should fail if the session is disposed', async () => {
const session = Session.connectTo(defaultSession.model);
session.dispose();
await expectFailure(session.shutdown(), 'Session is disposed');
});
Session.listRunning().then(sessionModels => {
for (let i=0; i {
console.log('comm msg');
let dat = msg['content']['data'];
let event = new MessageEvent('msg', {data:dat});
this.open(event);
};
this._ws.onClose = () => {
console.log('comm closed');
this.close(new CloseEvent('close'))
};
this._ws.open('opened');
}
}
});
return Session.findByPath(Kernels.session_path).then(model => {
return Session.connectTo(model.id).then(s => {
this.session = s;
return this.session;
});
}, () => {
let options: Session.IOptions = {
name: spec.display_name,
options
};
});
this.listView.onConfirmed = this.startSession.bind(this, gatewayName);
await this.listView.selectListView.update({
items: items,
emptyMessage: "No kernel specs available",
infoMessage: "Select a session",
loadingMessage: null
});
} else {
this.onSessionChosen(
gatewayName,
await Session.connectTo(sessionInfo.model.id, sessionInfo.options)
);
}
}