microsoft / microsoft/WinAppVSCE
test: add unit coverage for pickSignableFile/pickCertificateFile Browse and zero-results dialog branches
Nobody has claimed this yet.
- 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:
- Browse selected — When the user selects "Browse…" from the QuickPick,
selectFile()(which wrapsvscode.window.showOpenDialog) is called. This branch is not tested. - 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. - 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
showOpenDialogwith correct filters - Zero-results triggers
showOpenDialogdirectly (no QuickPick shown) - Certificate Browse path invokes
showOpenDialogwith certificate filters
Additional context
Surfaced during PR review of #100. This is a pre-existing coverage gap not introduced by that PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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