mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 02:41:39 +00:00
Fix notebook kernel selection and auto-kernel-start (#254)
* Fix bug: cannot select kernel. Properly plug-in kernelspecs middleware to redux store configuration * Properly auto-launch kernel with nteract's epic * Keep kernel lazy start for notebook viewer * Add unit tets
This commit is contained in:
48
src/Explorer/Notebook/notebookClientV2.test.ts
Normal file
48
src/Explorer/Notebook/notebookClientV2.test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
jest.mock("./NotebookComponent/store");
|
||||
jest.mock("@nteract/core");
|
||||
import { NotebookClientV2 } from "./NotebookClientV2";
|
||||
import configureStore from "./NotebookComponent/store";
|
||||
import { defineConfigOption } from "@nteract/mythic-configuration";
|
||||
|
||||
describe("auto start kernel", () => {
|
||||
it("configure autoStartKernelOnNotebookOpen properly depending whether notebook is/is not read-only", async () => {
|
||||
(configureStore as jest.Mock).mockReturnValue({
|
||||
dispatch: () => {
|
||||
/* noop */
|
||||
}
|
||||
});
|
||||
|
||||
defineConfigOption({
|
||||
label: "editorType",
|
||||
key: "editorType",
|
||||
defaultValue: "foo"
|
||||
});
|
||||
|
||||
defineConfigOption({
|
||||
label: "autoSaveInterval",
|
||||
key: "autoSaveInterval",
|
||||
defaultValue: 1234
|
||||
});
|
||||
|
||||
[true, false].forEach(isReadOnly => {
|
||||
new NotebookClientV2({
|
||||
connectionInfo: {
|
||||
authToken: "autToken",
|
||||
notebookServerEndpoint: "notebookServerEndpoint"
|
||||
},
|
||||
databaseAccountName: undefined,
|
||||
defaultExperience: undefined,
|
||||
isReadOnly,
|
||||
contentProvider: undefined
|
||||
});
|
||||
|
||||
expect(configureStore).toHaveBeenCalledWith(
|
||||
expect.anything(), // initial state
|
||||
undefined, // content provider
|
||||
expect.anything(), // onTraceFailure
|
||||
expect.anything(), // customMiddlewares
|
||||
!isReadOnly
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user