forked from jupyter-server/jupyter_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up JS tests (jupyter-server#103)
* clean up JS tests * more cleanup
- Loading branch information
Steve Silvester
authored and
GitHub Enterprise
committed
Aug 30, 2021
1 parent
136d9b7
commit 9b20103
Showing
3 changed files
with
102 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { sessionContextDialogs } from '@jupyterlab/apputils'; | ||
|
||
import { editorServices } from '@jupyterlab/codemirror'; | ||
|
||
import { | ||
NotebookPanel, | ||
NotebookWidgetFactory, | ||
StaticNotebook | ||
} from '@jupyterlab/notebook'; | ||
|
||
import { NBTestUtils } from '@jupyterlab/testutils'; | ||
|
||
/** | ||
* Create a notebook widget factory. | ||
*/ | ||
export function createNotebookWidgetFactory( | ||
options: Partial<NotebookWidgetFactory.IOptions<NotebookPanel>> = {} | ||
): NotebookWidgetFactory { | ||
// TODO: Replace with a factory from NBTestUtils when available | ||
return new NotebookWidgetFactory({ | ||
name: 'Notebook', | ||
fileTypes: ['notebook'], | ||
modelName: 'notebook', | ||
defaultFor: ['notebook'], | ||
preferKernel: true, | ||
canStartKernel: true, | ||
rendermime: NBTestUtils.defaultRenderMime(), | ||
contentFactory: NBTestUtils.createNotebookPanelFactory(), | ||
editorConfig: StaticNotebook.defaultEditorConfig, | ||
notebookConfig: StaticNotebook.defaultNotebookConfig, | ||
mimeTypeService: editorServices.mimeTypeService, | ||
sessionDialogs: sessionContextDialogs, | ||
...options | ||
}); | ||
} | ||
|
||
export const telemetryMessages = [ | ||
{ | ||
__timestamp__: '2021-08-26T11:36:40.946609Z', | ||
__schema__: 'event.datastudio.jupyter.com/session-message', | ||
__schema_version__: 1, | ||
__metadata_version__: 1, | ||
kernel_path: 'Untitled7.ipynb', | ||
kernel_id: 'bb4cd953-ef2d-4bb7-b5ea-80749e937796', | ||
message: | ||
'Starting a session for kernel: bb4cd953-ef2d-4bb7-b5ea-80749e937796.' | ||
}, | ||
{ | ||
__timestamp__: '2021-08-26T11:36:40.992769Z', | ||
__schema__: 'event.datastudio.jupyter.com/kernel-message', | ||
__schema_version__: 1, | ||
__metadata_version__: 1, | ||
process_id: 'e48b11fd-caf7-4c11-a35f-15f8337a585b', | ||
message: 'Current Status (attempt 1): Ready (Kernel is running.)', | ||
kernel_id: 'bb4cd953-ef2d-4bb7-b5ea-80749e937796' | ||
}, | ||
{ | ||
__timestamp__: '2021-08-26T11:36:40.993532Z', | ||
__schema__: 'event.datastudio.jupyter.com/kernel-status', | ||
__schema_version__: 1, | ||
__metadata_version__: 1, | ||
process_id: 'e48b11fd-caf7-4c11-a35f-15f8337a585b', | ||
status: 'Ready', | ||
details: 'Kernel is running.', | ||
kernel_id: 'bb4cd953-ef2d-4bb7-b5ea-80749e937796' | ||
}, | ||
{ | ||
__timestamp__: '2021-08-26T11:36:40.998530Z', | ||
__schema__: 'event.datastudio.jupyter.com/session-message', | ||
__schema_version__: 1, | ||
__metadata_version__: 1, | ||
kernel_path: 'Untitled7.ipynb', | ||
kernel_id: 'bb4cd953-ef2d-4bb7-b5ea-80749e937796', | ||
message: 'Session created for kernel.' | ||
} | ||
]; |