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 get the file type', () => {
const factory = new TextModelFactory();
expect(factory.contentType).to.equal('file');
});
});
it('should get the file type', () => {
let factory = new TextModelFactory();
expect(factory.contentType).to.be('file');
});
it('should get the preferred kernel language given an extension', () => {
const factory = new TextModelFactory();
expect(factory.preferredLanguage('.py')).to.equal('python');
expect(factory.preferredLanguage('.jl')).to.equal('julia');
});
});
it('should accept a language preference', () => {
const factory = new TextModelFactory();
const model = factory.createNew('foo');
expect(model.defaultKernelLanguage).to.equal('foo');
});
});
it('should be safe to call multiple times', () => {
let factory = new TextModelFactory();
factory.dispose();
factory.dispose();
expect(factory.isDisposed).to.be(true);
});
it('should get the file format', () => {
let factory = new TextModelFactory();
expect(factory.fileFormat).to.be('text');
});
it('should get the name of the model type', () => {
let factory = new TextModelFactory();
expect(factory.name).to.be('text');
});
function createContext(): Context {
const factory = new TextModelFactory();
const manager = new ServiceManager({ standby: 'never' });
const path = UUID.uuid4() + '.csv';
return new Context({ factory, manager, path });
}
describe('@jupyterlab/docmanager', () => {
let manager: LoggingManager;
let services: ServiceManager.IManager;
const textModelFactory = new TextModelFactory();
let context: Context;
const widgetFactory = new WidgetFactory({
name: 'test',
fileTypes: ['text']
});
const readOnlyFactory = new WidgetFactory({
name: 'readonly',
fileTypes: ['text'],
readOnly: true
});
before(() => {
services = new ServiceManager({ standby: 'never' });
});
beforeEach(() => {
describe('filebrowser/buttons', () => {
let services: ServiceManager.IManager;
let manager: DocumentManager;
let registry: DocumentRegistry;
let commands: CommandRegistry;
let model: FileBrowserModel;
let buttons: FileButtons;
let modelFactory = new TextModelFactory();
let widgetFactory = new WidgetFactory({
name: 'test',
fileExtensions: ['.txt'],
defaultFor: ['.txt']
});
let openedWidget: Widget;
before((done) => {
services = new ServiceManager();
services.ready.then(done, done);
});
beforeEach(() => {
openedWidget = null;
commands = new CommandRegistry();
registry = new DocumentRegistry();