Skip to content

Commit

Permalink
Merge pull request #259 from kubeshop/mm/fix/badassertionresults
Browse files Browse the repository at this point in the history
fix: check trace object before run the test
  • Loading branch information
mortada-codes committed Apr 20, 2022
2 parents 77ab898 + b131bd2 commit 2e70a3f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/src/components/Trace/Trace.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import styled from 'styled-components';
import {useStoreActions} from 'react-flow-renderer';
import {ReflexContainer, ReflexSplitter, ReflexElement} from 'react-reflex';
import {isEmpty} from 'lodash';

import {Button, Skeleton, Tabs} from 'antd';

Expand Down Expand Up @@ -78,7 +79,7 @@ const Trace: React.FC<TraceProps> = ({test, testResultId}) => {
}, [refetchTrace]);

useEffect(() => {
if (testResultDetails && !testResultDetails?.assertionResult) {
if (testResultDetails && !isEmpty(testResultDetails.trace) && !testResultDetails?.assertionResult) {
const resultList = runTest(testResultDetails.trace, test);

setTraceResultList(resultList);
Expand All @@ -88,15 +89,15 @@ const Trace: React.FC<TraceProps> = ({test, testResultId}) => {
resultId: testResultId,
assertionResult: parseAssertionResultListToTestResult(resultList),
});
} else if (testResultDetails?.assertionResult) {
} else if (testResultDetails?.assertionResult && !isEmpty(testResultDetails?.trace)) {
setTraceResultList(
parseTestResultToAssertionResultList(testResultDetails?.assertionResult, test, testResultDetails?.trace)
);
}
}, [testResultDetails, test, testResultId, updateTestResult]);

useEffect(() => {
if (testResultDetails) {
if (testResultDetails && !isEmpty(testResultDetails.trace)) {
const resultList = runTest(testResultDetails.trace, test);

setTraceResultList(resultList);
Expand Down

0 comments on commit 2e70a3f

Please sign in to comment.