From 44fac5a66971a6013c429537ab2b509d1a1a8a91 Mon Sep 17 00:00:00 2001 From: sebdet Date: Wed, 28 Apr 2021 11:12:45 +0200 Subject: Add Tests on UI Add some test to UI and fix errors reported by JEST during Ui tests Issue-ID: POLICY-3200 Signed-off-by: sebdet Change-Id: I69e93ad1f1714fa60a0c7ea9b1f3fb691f089f8a Signed-off-by: sebdet --- .../src/components/loop_viewer/logs/LoopLogs.js | 7 +++---- .../logs/__snapshots__/LoopLogs.test.js.snap | 1 + .../components/loop_viewer/status/LoopStatus.js | 7 ++++--- .../status/__snapshots__/LoopStatus.test.js.snap | 2 ++ .../src/components/loop_viewer/svg/SvgGenerator.js | 24 +++++++++++----------- 5 files changed, 22 insertions(+), 19 deletions(-) (limited to 'ui-react/src/components/loop_viewer') diff --git a/ui-react/src/components/loop_viewer/logs/LoopLogs.js b/ui-react/src/components/loop_viewer/logs/LoopLogs.js index b3f052626..e3d9f601f 100644 --- a/ui-react/src/components/loop_viewer/logs/LoopLogs.js +++ b/ui-react/src/components/loop_viewer/logs/LoopLogs.js @@ -66,10 +66,9 @@ export default class LoopLogs extends React.Component { } renderLogs() { - if (this.state.loopCache.getLoopLogsArray() != null) { - return ( - this.state.loopCache.getLoopLogsArray().map(row => ) - ) + let logsArray = this.state.loopCache.getLoopLogsArray(); + if (logsArray != null) { + return (logsArray.map(row => )); } } diff --git a/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap b/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap index 75b817bab..996c67457 100644 --- a/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap +++ b/ui-react/src/components/loop_viewer/logs/__snapshots__/LoopLogs.test.js.snap @@ -45,6 +45,7 @@ exports[`Verify LoopLogs Test the render method 1`] = ` { + let componentStates = this.state.loopCache.getComponentStates(); + if (componentStates != null) { + return Object.keys(componentStates).map((key) => { console.debug("Adding status for: ",key); var res={} res[key]=this.state.loopCache.getComponentStates()[key]; - return () + return () }) } diff --git a/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap b/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap index 73da5fff1..24d879de9 100644 --- a/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap +++ b/ui-react/src/components/loop_viewer/status/__snapshots__/LoopStatus.test.js.snap @@ -40,6 +40,7 @@ exports[`Verify LoopStatus Test the render method 1`] = ` - - - {allTheElements} - + + + {allTheElements} + ); -- cgit 1.2.3-korg