diff options
author | lapentafd <francesco.lapenta@est.tech> | 2022-03-02 14:35:12 +0000 |
---|---|---|
committer | lapentafd <francesco.lapenta@est.tech> | 2022-03-02 16:42:17 +0000 |
commit | 315fbead01457331c75b67ffcf0e17fcfb16a58c (patch) | |
tree | 8328968c7fe6b0fe2fdc1469ef5d57c1e14b000b /gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js | |
parent | 68d8522852e49d5553418cc19981fda25cf90d7e (diff) |
Code Coverage in gui ui react
Issue-ID: POLICY-3351
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
Change-Id: I0a2ada8e19619eaf95012300c7a3c2c6013f2495
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js')
-rw-r--r-- | gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js b/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js index 74c9145..e5a2f9f 100644 --- a/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js +++ b/gui-clamp/ui-react/src/components/dialogs/PerformActions.test.js @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,4 +93,29 @@ describe('Verify PerformActions', () => { expect(historyMock.push.mock.calls[0]).toEqual(['/']); }); + it('Test the delete method action', 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.refreshStatus = jest.fn().mockImplementation(() => { + return Promise.resolve({ + ok: true, + status: 200, + json: () => { + } + }); + }); + const component = shallow(<PerformActions loopCache={ loopCache } + loopAction="delete" history={ historyMock } updateLoopFunction={ updateLoopFunction } showSucAlert={ showSucAlert } showFailAlert={ showFailAlert } + setBusyLoading={ setBusyLoading } clearBusyLoading={ clearBusyLoading }/>) + await flushPromises(); + component.update(); + + expect(historyMock.push.mock.calls[0]).toEqual(['/']); + }); }); |