Handle "null" statusCheckRollup values on commits

Signed-off-by: Brian Phillips <28457+brianphillips@users.noreply.github.com>
This commit is contained in:
Brian Phillips
2024-03-27 12:11:31 -05:00
parent 560c6854cb
commit 617faf0233
5 changed files with 9 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-github-pull-requests-board': patch
---
Handle null values returned from GitHub for the statusCheckRollup value on the commit object
@@ -92,7 +92,7 @@ const CardHeader: FunctionComponent<Props> = (props: Props) => {
<Box display="flex" alignItems="center" flexWrap="wrap" paddingTop={1}>
<Typography variant="body2" component="p">
Commit Status:{' '}
<strong>{status.commit.statusCheckRollup.state}</strong>
<strong>{status.commit.statusCheckRollup?.state || 'N/A'}</strong>
</Typography>
</Box>
)}
@@ -96,9 +96,7 @@ jest.mock('../../hooks/usePullRequestsByTeam', () => {
isArchived: false,
status: {
commit: {
statusCheckRollup: {
state: 'FAILURE',
},
statusCheckRollup: null,
},
},
}),
@@ -96,9 +96,7 @@ jest.mock('../../hooks/usePullRequestsByTeam', () => {
isArchived: false,
status: {
commit: {
statusCheckRollup: {
state: 'FAILURE',
},
statusCheckRollup: null,
},
},
}),
@@ -85,7 +85,7 @@ export type Status = {
commit: {
statusCheckRollup: {
state: string;
};
} | null;
};
};