X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ui-react%2Fsrc%2Fcomponents%2Fdialogs%2FPerformActions.test.js;h=c91c2f675097f5c72162288c0492bf27d29bbeb6;hb=4fb32395392c3c65ad8dcadc42d7804d2e656c63;hp=56fdcf39b32754af17d0166b35cc83d31cb9efef;hpb=564fdb0c2e601df73813a4e9d080bd1666befce4;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..c91c2f67 100644 --- a/ui-react/src/components/dialogs/PerformActions.test.js +++ b/ui-react/src/components/dialogs/PerformActions.test.js @@ -36,6 +36,10 @@ describe('Verify PerformActions', () => { const flushPromises = () => new Promise(setImmediate); const historyMock = { push: jest.fn() }; const updateLoopFunction = jest.fn(); + const showSucAlert = jest.fn(); + const showFailAlert = jest.fn(); + const setBusyLoading = jest.fn(); + const clearBusyLoading = jest.fn(); LoopActionService.refreshStatus = jest.fn().mockImplementation(() => { return Promise.resolve({ @@ -44,21 +48,22 @@ describe('Verify PerformActions', () => { json: () => {} }); }); - const jsdomAlert = window.alert; - window.alert = () => {}; const component = shallow() + loopAction="submit" history={historyMock} updateLoopFunction={updateLoopFunction} showSucAlert={showSucAlert} showFailAlert={showFailAlert} setBusyLoading={setBusyLoading} clearBusyLoading={clearBusyLoading}/>) 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 showSucAlert = jest.fn(); + const showFailAlert = jest.fn(); + const setBusyLoading = jest.fn(); + const clearBusyLoading = jest.fn(); LoopActionService.performAction = jest.fn().mockImplementation(() => { return Promise.resolve({ @@ -74,15 +79,12 @@ describe('Verify PerformActions', () => { json: () => {} }); }); - const jsdomAlert = window.alert; - window.alert = () => {}; const component = shallow() + loopAction="submit" history={historyMock} updateLoopFunction={updateLoopFunction} showSucAlert={showSucAlert} showFailAlert={showFailAlert} setBusyLoading={setBusyLoading} clearBusyLoading={clearBusyLoading}/>) await flushPromises(); component.update(); expect(historyMock.push.mock.calls[0]).toEqual([ '/']); - window.alert = jsdomAlert; }); });