aboutsummaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js')
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js20
1 files changed, 6 insertions, 14 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
index 5e30924..cce6225 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.test.js
@@ -17,7 +17,7 @@
* ============LICENSE_END=========================================================
*/
-import { mount, shallow } from "enzyme";
+import { shallow } from "enzyme";
import toJson from "enzyme-to-json";
import { createMemoryHistory } from "history";
import React from "react";
@@ -25,39 +25,31 @@ import MonitorInstantiation from "./MonitorInstantiation";
import { act } from "react-dom/test-utils";
describe('Verify MonitoringInstantiation', () => {
-
- it("renders without crashing", () => {
- shallow(<MonitorInstantiation/>);
- });
+ const container = shallow(<MonitorInstantiation />);
+ const containerWithHistory = shallow(<MonitorInstantiation history={ createMemoryHistory() }/>);
it("renders correctly", () => {
- const tree = shallow(<MonitorInstantiation/>);
- expect(toJson(tree)).toMatchSnapshot();
+ expect(toJson(container)).toMatchSnapshot();
});
it('should have a Button element', () => {
- const container = shallow(<MonitorInstantiation/>)
expect(container.find('Button').length).toEqual(1);
});
it('handleClose called when bottom button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<MonitorInstantiation history={ history }/>)
const logSpy = jest.spyOn(console, 'log');
act(() => {
- component.find('[variant="secondary"]').simulate('click');
+ containerWithHistory.find('[variant="secondary"]').simulate('click');
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
});
it('handleClose called when top-right button clicked', () => {
- const history = createMemoryHistory();
- const component = mount(<MonitorInstantiation history={ history }/>)
const logSpy = jest.spyOn(console, 'log');
act(() => {
- component.find('[size="xl"]').get(0).props.onHide();
+ containerWithHistory.find('[size="xl"]').get(0).props.onHide();
expect(logSpy).toHaveBeenCalledWith('handleClose called');
});
});