aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/loop_viewer
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2019-10-01 15:34:53 +0200
committerxuegao <xg353y@intl.att.com>2019-10-01 15:34:53 +0200
commit233e3cdba0aec0f0c21cc5986654feb33cb7eb3d (patch)
tree686fa173440210eb34555f458d37c3518a7c4125 /ui-react/src/components/loop_viewer
parent58c7c977bed829fe010849cdf1b3f654c3c8cc02 (diff)
Add react ui tests
Add more tests for react UI. Issue-ID: CLAMP-509 Change-Id: I58f6408bcd8667fa8b16b0b2f31f8287bdfac8c9 Signed-off-by: xuegao <xg353y@intl.att.com>
Diffstat (limited to 'ui-react/src/components/loop_viewer')
-rw-r--r--ui-react/src/components/loop_viewer/logs/LoopLogs.test.js24
-rw-r--r--ui-react/src/components/loop_viewer/status/LoopStatus.test.js24
2 files changed, 47 insertions, 1 deletions
diff --git a/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js b/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js
index 3c76405c4..5c478f6a5 100644
--- a/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js
+++ b/ui-react/src/components/loop_viewer/logs/LoopLogs.test.js
@@ -42,7 +42,29 @@ describe('Verify LoopLogs', () => {
it('Test the render method', () => {
const component = shallow(<LoopLogs loopCache={loopCache}/>)
-
expect(component).toMatchSnapshot();
+
+ const loopCacheUpdated = new LoopCache({
+ "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
+ "loopLogs": [
+ {
+ "id": 1,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Operational and Guard policies UPDATED",
+ "logInstant": "2019-07-08T09:44:37Z"
+ },
+ {
+ "id": 2,
+ "logType": "INFO",
+ "logComponent": "CLAMP",
+ "message": "Operational and Guard policies UPDATED",
+ "logInstant": "2019-07-08T09:44:50Z"
+ }
+ ]
+ });
+
+ component.setProps({ loopCache: loopCacheUpdated });
+ expect(component.find('TableRow').length).toEqual(2);
});
}); \ No newline at end of file
diff --git a/ui-react/src/components/loop_viewer/status/LoopStatus.test.js b/ui-react/src/components/loop_viewer/status/LoopStatus.test.js
index 2be825edc..8d0448796 100644
--- a/ui-react/src/components/loop_viewer/status/LoopStatus.test.js
+++ b/ui-react/src/components/loop_viewer/status/LoopStatus.test.js
@@ -50,5 +50,29 @@ describe('Verify LoopStatus', () => {
const component = shallow(<LoopStatus loopCache={loopCache}/>)
expect(component).toMatchSnapshot();
+
+ const loopCacheUpdated = new LoopCache({
+ "name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
+ "lastComputedState": "SUBMIT",
+ "components": {
+ "POLICY": {
+ "componentState": {
+ "stateName": "SENT",
+ "description": "The policies defined have NOT yet been created on the policy engine"
+ }
+ },
+ "DCAE": {
+ "componentState": {
+ "stateName": "BLUEPRINT_DEPLOYED",
+ "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
+ }
+ }
+ }
+ });
+ component.setProps({ loopCache: loopCacheUpdated });
+
+ const forms = component.find('TableRow');
+ expect(forms.get(0).props.statusRow.stateName).toEqual("SENT");
+ expect(component.find('label').text()).toContain('SUBMIT');
});
}); \ No newline at end of file