From f7e395930c86068207b5d57f08aef1f162af5217 Mon Sep 17 00:00:00 2001 From: vikash7485 Date: Mon, 10 Aug 2026 15:41:26 +0530 Subject: [PATCH] test(web): add coverage for isDeploymentRunning all enum values Add unit tests for all 7 DeploymentStatus enum variants (PENDING, PLANNED, RUNNING, ROLLING_BACK, SUCCESS, FAILURE, CANCELLED) plus the undefined edge case. This brings the utility from 0% to 100% branch coverage. Related: https://github.com/pipe-cd/pipecd/issues/6706 Signed-off-by: vikash7485 --- web/src/utils/is-deployment-running.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 web/src/utils/is-deployment-running.test.ts diff --git a/web/src/utils/is-deployment-running.test.ts b/web/src/utils/is-deployment-running.test.ts new file mode 100644 index 0000000000..d3af9d4f37 --- /dev/null +++ b/web/src/utils/is-deployment-running.test.ts @@ -0,0 +1,17 @@ +import { DeploymentStatus } from "~~/model/deployment_pb"; +import { isDeploymentRunning } from "./is-deployment-running"; + +describe("isDeploymentRunning", () => { + it.each([ + [DeploymentStatus.DEPLOYMENT_PENDING, true], + [DeploymentStatus.DEPLOYMENT_PLANNED, true], + [DeploymentStatus.DEPLOYMENT_RUNNING, true], + [DeploymentStatus.DEPLOYMENT_ROLLING_BACK, true], + [DeploymentStatus.DEPLOYMENT_SUCCESS, false], + [DeploymentStatus.DEPLOYMENT_FAILURE, false], + [DeploymentStatus.DEPLOYMENT_CANCELLED, false], + [undefined, false], + ])("given status %p, returns %p", (status, expected) => { + expect(isDeploymentRunning(status)).toBe(expected); + }); +});