From 2fcd62e80ce866c6a3053b6281fd7d09b5e126ac Mon Sep 17 00:00:00 2001 From: Josh Uvi Date: Tue, 20 Feb 2024 16:40:06 +0000 Subject: [PATCH] chore: hide status if undefined (review change) Signed-off-by: Josh Uvi --- .gitignore | 5 ++++- .../src/components/Card/CardHeader.test.tsx | 7 ++++++- .../src/components/Card/CardHeader.tsx | 14 ++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index c0ef0d2001..b229919872 100644 --- a/.gitignore +++ b/.gitignore @@ -162,4 +162,7 @@ e2e-test-report/ *svg.dtmp # Scripts -plugins-report.csv \ No newline at end of file +plugins-report.csv +github-matt-credentails.yaml +app-config-local.yaml +packages/app/src/cookieAuth.ts \ No newline at end of file diff --git a/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx b/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx index b4bda755d2..02f8b8c837 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx @@ -69,7 +69,12 @@ describe('', () => { }); it('does not find commit status in PR Card Header when PR does not include status', async () => { - await renderInTestApp(); + const propsWithNoStatus = { + ...props, + status: undefined, + }; + await renderInTestApp(); expect(CardHeader.defaultProps?.status).toBeUndefined(); + expect(screen.queryByText('Commit Status:')).not.toBeInTheDocument(); }); }); diff --git a/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx b/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx index 652cf740c4..15919d4297 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx @@ -88,12 +88,14 @@ const CardHeader: FunctionComponent = (props: Props) => { )} - - - Commit Status:{' '} - {status?.commit.statusCheckRollup.state} - - + {status && ( + + + Commit Status:{' '} + {status.commit.statusCheckRollup.state} + + + )} {labels && ( {labels.map(data => {