Fix Sonar vulnerabilities
Fix the vulnerabilities reported by Sonar.
Issue-ID: CLAMP-530
Change-Id: I9f6a7fe9ce042045085c371ef3777188b11ffb36
Signed-off-by: xuegao <xg353y@intl.att.com>
diff --git a/ui-react/src/components/dialogs/DeployLoop.test.js b/ui-react/src/components/dialogs/DeployLoop.test.js
index 2959ed6..44bc783 100644
--- a/ui-react/src/components/dialogs/DeployLoop.test.js
+++ b/ui-react/src/components/dialogs/DeployLoop.test.js
@@ -61,6 +61,7 @@
const flushPromises = () => new Promise(setImmediate);
const historyMock = { push: jest.fn() };
const updateLoopFunction = jest.fn();
+ const showAlert = jest.fn();
const handleSave = jest.spyOn(DeployLoop.prototype,'handleSave');
LoopService.updateGlobalProperties = jest.fn().mockImplementation(() => {
return Promise.resolve({
@@ -83,10 +84,9 @@
json: () => {}
});
});
- const jsdomAlert = window.alert;
- window.alert = () => {};
+
const component = shallow(<DeployLoop history={historyMock}
- loopCache={loopCache} updateLoopFunction={updateLoopFunction} />)
+ loopCache={loopCache} updateLoopFunction={updateLoopFunction} showAlert={showAlert} />)
component.find('[variant="primary"]').prop('onClick')();
await flushPromises();
@@ -95,7 +95,6 @@
expect(handleSave).toHaveBeenCalledTimes(1);
expect(component.state('show')).toEqual(false);
expect(historyMock.push.mock.calls[0]).toEqual([ '/']);
- window.alert = jsdomAlert;
handleSave.mockClear();
});