mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-30 14:22:05 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
55
src/Explorer/Notebook/NotebookRenderer/StatusBar.test.tsx
Normal file
55
src/Explorer/Notebook/NotebookRenderer/StatusBar.test.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { shallow } from "enzyme";
|
||||
import React from "react";
|
||||
|
||||
import { StatusBar } from "./StatusBar";
|
||||
|
||||
describe("StatusBar", () => {
|
||||
test("can render on a dummyNotebook", () => {
|
||||
const lastSaved = new Date();
|
||||
const kernelSpecDisplayName = "python3";
|
||||
|
||||
const component = shallow(
|
||||
<StatusBar kernelStatus="kernel status" lastSaved={lastSaved} kernelSpecDisplayName={kernelSpecDisplayName} />
|
||||
);
|
||||
|
||||
expect(component).not.toBeNull();
|
||||
});
|
||||
test("Update if kernelSpecDisplayName has changed", () => {
|
||||
const lastSaved = new Date();
|
||||
const kernelSpecDisplayName = "python3";
|
||||
|
||||
const component = shallow(
|
||||
<StatusBar kernelStatus="kernel status" lastSaved={lastSaved} kernelSpecDisplayName={kernelSpecDisplayName} />
|
||||
);
|
||||
|
||||
const shouldUpdate = component.instance().shouldComponentUpdate(
|
||||
{
|
||||
lastSaved,
|
||||
kernelSpecDisplayName: "javascript",
|
||||
kernelStatus: "kernelStatus"
|
||||
},
|
||||
null,
|
||||
null
|
||||
);
|
||||
expect(shouldUpdate).toBe(true);
|
||||
});
|
||||
test("update if kernelStatus has changed", () => {
|
||||
const lastSaved = new Date();
|
||||
const kernelSpecDisplayName = "python3";
|
||||
|
||||
const component = shallow(
|
||||
<StatusBar kernelStatus="kernel status" lastSaved={lastSaved} kernelSpecDisplayName={kernelSpecDisplayName} />
|
||||
);
|
||||
|
||||
const shouldUpdate = component.instance().shouldComponentUpdate(
|
||||
{
|
||||
lastSaved: new Date(),
|
||||
kernelSpecDisplayName: "python3",
|
||||
kernelStatus: "kernelStatus"
|
||||
},
|
||||
null,
|
||||
null
|
||||
);
|
||||
expect(shouldUpdate).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user