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 require a context parameter', () => {
const widgetFactory = new MimeDocumentFactory({
name: 'markdown',
fileTypes: ['markdown'],
rendermime: RENDERMIME,
primaryFileType: DocumentRegistry.defaultTextFileType
});
expect(widgetFactory.createNew(dContext)).to.be.an.instanceof(
MimeDocument
);
});
});
it('should require a context parameter', () => {
const widgetFactory = new MimeDocumentFactory({
name: 'markdown',
fileTypes: ['markdown'],
rendermime: RENDERMIME,
primaryFileType: DocumentRegistry.defaultTextFileType
});
expect(widgetFactory.createNew(dContext)).to.be.an.instanceof(
MimeDocument
);
});
});
if (contentType === 'notebook') {
fileType = DocumentRegistry.defaultNotebookFileType;
ext = ext || fileType.extensions[0];
baseName = 'Untitled';
const modelFactory = this._docRegistry.getModelFactory('Notebook');
if (!modelFactory) {
throw Error('No model factory is registered with the DocRegistry');
}
model = {
type: fileType.contentType,
content: modelFactory.createNew().toJSON(),
mimetype: fileType.mimeTypes[0],
format: fileType.fileFormat
};
} else if (contentType === 'file') {
fileType = DocumentRegistry.defaultTextFileType;
ext = ext || fileType.extensions[0];
baseName = 'untitled';
model = {
type: fileType.contentType,
content: '',
mimetype: fileType.mimeTypes[0],
format: fileType.fileFormat
};
} else if (contentType === 'directory') {
fileType = DocumentRegistry.defaultDirectoryFileType;
ext = ext || '';
baseName = 'Untitled Folder';
model = {
type: fileType.contentType,
content: [],
format: fileType.fileFormat