From 564fdb0c2e601df73813a4e9d080bd1666befce4 Mon Sep 17 00:00:00 2001 From: xuegao Date: Wed, 2 Oct 2019 11:18:10 +0200 Subject: Add react ui test Add react ui test to improve code coverage. Issue-ID: CLAMP-509 Change-Id: Ic9c974a78ee453dddb8f985f3e9c9067f66e95d9 Signed-off-by: xuegao --- .../src/components/dialogs/OpenLoop/OpenLoopModal.test.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js') diff --git a/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js b/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js index 5153de956..208c947c3 100644 --- a/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js +++ b/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js @@ -34,9 +34,9 @@ describe('Verify OpenLoopModal', () => { "LOOP_gmtAS_v1_0_ResourceInstanceName2_tca_2" ])); }) - + it('Test the render method', () => { - + const component = shallow(); expect(component).toMatchSnapshot(); }); @@ -44,7 +44,6 @@ describe('Verify OpenLoopModal', () => { it('Onchange event', () => { const event = {value: 'LOOP_gmtAS_v1_0_ResourceInstanceName1_tca_3'}; const component = shallow(); - const forms = component.find('StateManager'); component.find('StateManager').simulate('change', event); component.update(); @@ -60,7 +59,7 @@ describe('Verify OpenLoopModal', () => { expect(handleClose).toHaveBeenCalledTimes(1); expect(component.state('show')).toEqual(false); - expect(historyMock.push.mock.calls[0]).toEqual([ '/', ]); + expect(historyMock.push.mock.calls[0]).toEqual([ '/']); handleClose.mockClear(); }); @@ -75,8 +74,8 @@ describe('Verify OpenLoopModal', () => { expect(handleOpen).toHaveBeenCalledTimes(1); expect(component.state('show')).toEqual(false); - expect(historyMock.push.mock.calls[0]).toEqual([ '/', ]); - + expect(historyMock.push.mock.calls[0]).toEqual([ '/']); + handleOpen.mockClear(); }); -- cgit 1.2.3-korg