microsoft / microsoft/WinAppVSCE

test: add unit coverage for pickSignableFile/pickCertificateFile Browse and zero-results dialog branches

Open
#102 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
13
Forks
3
Avg merge
6d 1h
Merged PRs (30d)
11

Description

Problem

The pickSignableFile and pickCertificateFile functions in src/extension.ts have several VS Code UI interaction branches that lack unit test coverage:

  1. Browse selected — When the user selects "Browse…" from the QuickPick, selectFile() (which wraps vscode.window.showOpenDialog) is called. This branch is not tested.
  2. Zero artifacts found — When no artifacts/certificates are found in the workspace, the function falls back directly to selectFile() without showing a QuickPick. This branch is not tested.
  3. Certificate Browse — Same as #1 but for the certificate picker flow.

The E2E test for Browse (sign-quickpick.spec.ts) is explicitly a smoke test because Playwright cannot interact with native OS file dialogs.

Proposed solution

Extract pickSignableFile and pickCertificateFile into a testable module (similar to the sign-flow.ts extraction done in #100) with an injectable adapter for showQuickPick and showOpenDialog, then add unit tests covering:

  • Browse selection triggers showOpenDialog with correct filters
  • Zero-results triggers showOpenDialog directly (no QuickPick shown)
  • Certificate Browse path invokes showOpenDialog with certificate filters
Additional context

Surfaced during PR review of #100. This is a pre-existing coverage gap not introduced by that PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/extension.ts with pickSignableFile and pickCertificateFile, then review the sign-flow.ts extraction from #100. Use sign-quickpick.spec.ts for the existing Browse behavior and add unit coverage for Browse, zero-results, and certificate filters; done means the relevant showOpenDialog calls and QuickPick behavior are asserted.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.