Skip to content

Commit

Permalink
fix: empty jest tests hide block
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 10, 2021
1 parent 3d12989 commit 09afcc2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ui/blocks/src/TestsCoverage/TestsCoverage.tsx
Expand Up @@ -25,7 +25,10 @@ export const TestsCoverage: FC<TestsCoverageProps> = ({
}) => {
const props = useCustomProps<TestsCoverageProps>('tests_coverage', rest);
const component = useStoryComponent({ id, name });
if (!component?.jest) {
if (
!component?.jest?.coverage ||
!Object.keys(component.jest.coverage).length
) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/src/TestsResults/BaseTestsResults.tsx
Expand Up @@ -185,7 +185,7 @@ export const BaseTestsResults: FC<BaseTestsResultsProps> = ({
),
[component?.jest?.results],
);
if (!component?.jest) {
if (!component?.jest?.results.length) {
return null;
}
return (
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/src/TestsResults/TestsResults.tsx
Expand Up @@ -26,7 +26,7 @@ export const TestsResults: FC<TestsResultsProps> = ({
const props = useCustomProps<TestsResultsProps>('tests_results', rest);
const component = useStoryComponent({ id, name });

if (!component?.jest) {
if (!component?.jest?.results.length) {
return null;
}

Expand Down

0 comments on commit 09afcc2

Please sign in to comment.