X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ui-react%2Fsrc%2Fcomponents%2Fdialogs%2FPerformActions.test.js;h=0b0786290c8ca62836d1b335b5e501f7b485ef11;hb=0efeb6b141cb4abe84af8eb38e26d5ed1ab73bb0;hp=56fdcf39b32754af17d0166b35cc83d31cb9efef;hpb=52432d6512d2477ad16d46f5ab31a8f77e9f77bd;p=clamp.git diff --git a/ui-react/src/components/dialogs/PerformActions.test.js b/ui-react/src/components/dialogs/PerformActions.test.js index 56fdcf39..0b078629 100644 --- a/ui-react/src/components/dialogs/PerformActions.test.js +++ b/ui-react/src/components/dialogs/PerformActions.test.js @@ -36,6 +36,7 @@ describe('Verify PerformActions', () => { const flushPromises = () => new Promise(setImmediate); const historyMock = { push: jest.fn() }; const updateLoopFunction = jest.fn(); + const showAlert = jest.fn(); LoopActionService.refreshStatus = jest.fn().mockImplementation(() => { return Promise.resolve({ @@ -44,21 +45,19 @@ describe('Verify PerformActions', () => { json: () => {} }); }); - const jsdomAlert = window.alert; - window.alert = () => {}; const component = shallow() + loopAction="submit" history={historyMock} updateLoopFunction={updateLoopFunction} showAlert={showAlert} />) await flushPromises(); component.update(); expect(historyMock.push.mock.calls[0]).toEqual([ '/']); - window.alert = jsdomAlert; }); it('Test the render method action successful', async () => { const flushPromises = () => new Promise(setImmediate); const historyMock = { push: jest.fn() }; const updateLoopFunction = jest.fn(); + const showAlert = jest.fn(); LoopActionService.performAction = jest.fn().mockImplementation(() => { return Promise.resolve({ @@ -74,15 +73,12 @@ describe('Verify PerformActions', () => { json: () => {} }); }); - const jsdomAlert = window.alert; - window.alert = () => {}; const component = shallow() + loopAction="submit" history={historyMock} updateLoopFunction={updateLoopFunction} showAlert={showAlert} />) await flushPromises(); component.update(); expect(historyMock.push.mock.calls[0]).toEqual([ '/']); - window.alert = jsdomAlert; }); });