Skip to content

test(e2e): cover tfvc.setPat command branches - #34

Merged
jschfflr merged 1 commit into
mainfrom
test/e2e-set-pat
Apr 21, 2026
Merged

test(e2e): cover tfvc.setPat command branches#34
jschfflr merged 1 commit into
mainfrom
test/e2e-set-pat

Conversation

@jschfflr

Copy link
Copy Markdown
Contributor

Summary

  • tfvc.setPat had three uncovered branches: cancel (undefined), store (value), clear (empty string). A refactor that conflated them — showing "stored" when actually clearing, for instance — would ship silently.
  • Added 4 tests executing each branch with showInputBox stubbed and asserting which toast fires. One regression test verifies stored/removed messages are distinct.
  • Can't read the secret store directly (ExtensionContext isn't exposed to tests), so assertions target user-visible toasts. suiteTeardown clears the secret between runs.

Test plan

  • npm run test:e2e — 20 passing (was 16)

🤖 Generated with Claude Code

The three branches — cancel / store / clear — were uncovered. A
refactor that conflated them (e.g. showed "stored" when actually
clearing) would ship to users. Catch that by executing each branch
with the input-box stubbed to return undefined / a value / empty
string, and asserting which toast fires.

Can't read the secret store directly from tests (ExtensionContext
isn't exposed to test code), so the assertions target user-visible
behaviour. A suiteTeardown clears the secret afterwards so the test
profile doesn't inherit a stored PAT between runs.

e2e count: 16 → 20.
@jschfflr
jschfflr merged commit 00823c8 into main Apr 21, 2026
2 checks passed
@jschfflr
jschfflr deleted the test/e2e-set-pat branch April 21, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant