Don't say analyses failed when the workflow was canceled

This commit is contained in:
Robert
2023-04-19 11:52:39 +01:00
parent 7b03a6ed14
commit b5ad37a094
3 changed files with 30 additions and 6 deletions

View File

@@ -108,4 +108,5 @@ export const Stopped = Template.bind({});
Stopped.args = {
...Started.args,
variantAnalysisStatus: VariantAnalysisStatus.Canceled,
completedRepositoryCount: 10,
};

View File

@@ -24,12 +24,21 @@ function getIcon(
skippedRepositoryCount: number,
) {
if (successfulRepositoryCount < completedRepositoryCount) {
return (
<>
<HorizontalSpace size={2} />
<ErrorIcon label="Some analyses failed" />
</>
);
if (variantAnalysisStatus === VariantAnalysisStatus.Canceled) {
return (
<>
<HorizontalSpace size={2} />
<ErrorIcon label="Some analyses were stopped" />
</>
);
} else {
return (
<>
<HorizontalSpace size={2} />
<ErrorIcon label="Some analyses failed" />
</>
);
}
} else if (skippedRepositoryCount > 0) {
return (
<>

View File

@@ -108,6 +108,20 @@ describe(VariantAnalysisStats.name, () => {
).toBeInTheDocument();
});
it("renders an error icon when the overall variant analysis status is canceled and some analyses failed", () => {
render({
variantAnalysisStatus: VariantAnalysisStatus.Canceled,
completedRepositoryCount: 10,
successfulRepositoryCount: 5,
});
expect(
screen.getByRole("img", {
name: "Some analyses were stopped",
}),
).toBeInTheDocument();
});
it("renders an error icon when some analyses failed but also some repositories were skipped", () => {
render({
completedRepositoryCount: 10,