aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2020-01-06 16:13:46 +0100
committerxuegao <xg353y@intl.att.com>2020-01-07 10:39:23 +0100
commit2f5b2cdb2a7650d6bd41d1b20ec0813cad7989ed (patch)
treec5b2234a860b48172edd9abe5fdafe3121a84669 /ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
parentbcbc25bbb78876db27fc326aadf89086200c3c76 (diff)
Add button to refresh op policy UI
Add the button on Operational Policy UI to refresh the json representation. Issue-ID: CLAMP-584 Change-Id: I3ae6ca0207bf9ca84f1e1dc6b3aed42b90298d8e Signed-off-by: xuegao <xg353y@intl.att.com>
Diffstat (limited to 'ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js')
-rw-r--r--ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
index 522a3f681..c10c6ff0a 100644
--- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
+++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
@@ -57,7 +57,7 @@ describe('Verify OperationalPolicyModal', () => {
const handleClose = jest.spyOn(OperationalPolicyModal.prototype,'handleClose');
const component = mount(<OperationalPolicyModal history={historyMock} loopCache={loopCache}/>)
- component.find('[variant="secondary"]').prop('onClick')();
+ component.find('[variant="secondary"]').get(0).props.onClick();
expect(handleClose).toHaveBeenCalledTimes(1);
expect(component.state('show')).toEqual(false);
@@ -78,4 +78,17 @@ describe('Verify OperationalPolicyModal', () => {
expect(component.state('show')).toEqual(false);
expect(historyMock.push.mock.calls[0]).toEqual([ '/']);
});
+
+ it('Test handleRefresh', async () => {
+ const updateLoopFunction = jest.fn();
+ const handleRefresh = jest.spyOn(OperationalPolicyModal.prototype,'handleRefresh');
+ const component = mount(<OperationalPolicyModal loopCache={loopCache} updateLoopFunction={updateLoopFunction} />)
+
+ component.find('[variant="secondary"]').get(1).props.onClick();
+ await flushPromises();
+ component.update();
+
+ expect(handleRefresh).toHaveBeenCalledTimes(1);
+ expect(component.state('show')).toEqual(true);
+ });
}); \ No newline at end of file