mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-25 11:51:07 +00:00
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import { PrimaryButton } from "@fluentui/react";
|
|
import { mount } from "enzyme";
|
|
import React from "react";
|
|
import Explorer from "../../Explorer";
|
|
import { SetupNoteBooksPanel } from "./SetupNotebooksPanel";
|
|
|
|
describe("Setup Notebooks Panel", () => {
|
|
it("should render Default properly", () => {
|
|
const fakeExplorer = {} as Explorer;
|
|
const props = {
|
|
explorer: fakeExplorer,
|
|
closePanel: (): void => undefined,
|
|
openNotificationConsole: (): void => undefined,
|
|
panelTitle: "",
|
|
panelDescription: "",
|
|
};
|
|
const wrapper = mount(<SetupNoteBooksPanel {...props} />);
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it("should render button", () => {
|
|
const fakeExplorer = {} as Explorer;
|
|
const props = {
|
|
explorer: fakeExplorer,
|
|
closePanel: (): void => undefined,
|
|
openNotificationConsole: (): void => undefined,
|
|
panelTitle: "",
|
|
panelDescription: "",
|
|
};
|
|
const wrapper = mount(<SetupNoteBooksPanel {...props} />);
|
|
const button = wrapper.find("PrimaryButton").first();
|
|
expect(button).toBeDefined();
|
|
});
|
|
|
|
it("Button onClick should call onCompleteSetup", () => {
|
|
const onCompleteSetupClick = jest.fn();
|
|
const wrapper = mount(<PrimaryButton onClick={onCompleteSetupClick} />);
|
|
wrapper.find("button").simulate("click");
|
|
|
|
expect(onCompleteSetupClick).toHaveBeenCalled();
|
|
});
|
|
|
|
it("Button onKeyPress should call onCompleteSetupKeyPress", () => {
|
|
const onCompleteSetupKeyPress = jest.fn();
|
|
const wrapper = mount(<PrimaryButton onKeyPress={onCompleteSetupKeyPress} />);
|
|
wrapper.find("button").simulate("keypress");
|
|
|
|
expect(onCompleteSetupKeyPress).toHaveBeenCalled();
|
|
});
|
|
});
|