Skip to content

test(web): add unit tests for isDeploymentRunning utility - #7145

Open
vikash7485 wants to merge 2 commits into
pipe-cd:masterfrom
vikash7485:test/add-coverage-for-is-deployment-running
Open

test(web): add unit tests for isDeploymentRunning utility#7145
vikash7485 wants to merge 2 commits into
pipe-cd:masterfrom
vikash7485:test/add-coverage-for-is-deployment-running

Conversation

@vikash7485

@vikash7485 vikash7485 commented Aug 10, 2026

Copy link
Copy Markdown

What this PR does:

Add unit tests for isDeploymentRunning in web/src/utils/is-deployment-running.ts, covering all 7 DeploymentStatus enum values and the undefined edge case.

Why we need it:

This utility has zero test coverage despite being a critical decision function called in:

  • DeploymentDetailPage (controls polling interval)
    • DeploymentDetail (controls cancel button visibility)
    • Pipeline component (determines if stages are interactive)
      Without tests, future enum additions to DeploymentStatus could silently break polling behavior with no regression signal.

Which issue(s) this PR fixes:

Fixes #
Does this PR introduce a user-facing change?:

No. This PR only adds test coverage for an existing utility function.

  • How are users affected by this change: No user-facing impact.
    • Is this breaking change: No.
    • How to migrate (if breaking change): N/A.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi @vikash7485, welcome to PipeCD and thanks for opening your first pull request!

We’re really happy to have you here

Before your PR gets merged, please check a few important things below.


Helpful resources


DCO Sign-off

All commits must include a Signed-off-by line to comply with the Developer Certificate of Origin (DCO).

In case you forget to sign-off your commit(s), follow these steps:

For the last commit:

git commit --amend --signoff
git push --force-with-lease

For multiple commits:

git rebase --signoff origin/master
git push --force-with-lease

Run checks locally

Before pushing updates, please run:

make check

This runs the same checks as CI and helps catch issues early.


💬 Need help?

If anything is unclear, feel free to ask in this PR or join us on the CNCF Slack in the #pipecd channel.
You can get your Slack invite from: https://communityinviter.com/apps/cloud-native/cncf

Thanks for contributing to PipeCD! ❤️

@vikash7485
vikash7485 force-pushed the test/add-coverage-for-is-deployment-running branch 2 times, most recently from 2ffa638 to f5ccc5b Compare August 11, 2026 04:02

@rahulshendre rahulshendre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 7 cases could fold into one it.each table, we can trim the repetition.
Also Fixes #6915 is not really correct - that's the Snyk alpine upgrade PR, please fix it.

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: pipe-cd#6706
Signed-off-by: vikash7485 <vikkiraj073@gmail.com>
@vikash7485
vikash7485 force-pushed the test/add-coverage-for-is-deployment-running branch from 164b755 to f7e3959 Compare August 21, 2026 09:48
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for pipecd-site ready!

Name Link
🔨 Latest commit 1d7b529
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6a882160d1a6d800082c362b
😎 Deploy Preview https://deploy-preview-7145--pipecd-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants