summaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
diff options
context:
space:
mode:
authorXue Gao <xg353y@intl.att.com>2020-05-26 07:22:41 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-26 07:22:41 +0000
commit3521f1dd8b2447d5225c51acdf1472c4c94a3ed3 (patch)
tree28f5a6f0c94c499f71d28be043884ef5e1868ea6 /ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
parenta1668ebbcf5c010a495c56e78178a615f52c655b (diff)
parentc0ec0fc448af1c5d6eacb195e95938c921ba1bce (diff)
Merge "Create SVG in UI"
Diffstat (limited to 'ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js')
-rw-r--r--ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js b/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
index f362cfaa6..1865869df 100644
--- a/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
+++ b/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
@@ -23,6 +23,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import OpenLoopModal from './OpenLoopModal';
+import LoopService from '../../../api/LoopService';
describe('Verify OpenLoopModal', () => {
@@ -41,10 +42,19 @@ describe('Verify OpenLoopModal', () => {
expect(component).toMatchSnapshot();
});
- it('Onchange event', () => {
+ it('Onchange event', async () => {
+ const flushPromises = () => new Promise(setImmediate);
+ LoopService.getLoop = jest.fn().mockImplementation(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => {}
+ });
+ });
const event = {value: 'LOOP_gmtAS_v1_0_ResourceInstanceName1_tca_3'};
const component = shallow(<OpenLoopModal/>);
component.find('StateManager').simulate('change', event);
+ await flushPromises();
component.update();
expect(component.state('chosenLoopName')).toEqual("LOOP_gmtAS_v1_0_ResourceInstanceName1_tca_3");
});