Summary
The ReopenQRCode command in src/extension/commands/reopenQRCode.ts has no dedicated unit tests. Its success path creates an Expo QR Code webview and renders the current QR Code URL, while its failure path throws FailedToReopenQRCode when no URL is available.
Why this is useful
Reopening the Expo QR Code is a user-facing command, but its webview contract and missing-URL behavior are currently unguarded. Focused unit tests can cover both paths without launching Expo, creating a real webview, or generating a QR image.
Suggested scope
- Add
test/extension/commands/reopenQRCode.test.ts using the existing proxyquire + Sinon command-test pattern.
- Stub
getQRCodeUrl, QRCodeContentProvider, and the required vscode APIs before importing the command module.
- Test when a QR Code URL exists:
createWebviewPanel is called with the expected view type, title, column, and options.
- Verify the URL is parsed, passed to
provideTextDocumentContent, and the returned HTML is assigned to the webview.
- Test when no QR Code URL exists:
baseFn() rejects with InternalErrorCode.FailedToReopenQRCode and no webview is created.
Evidence
src/extension/commands/reopenQRCode.ts contains distinct URL-present and URL-missing branches.
- The current test suite only checks that
reactNative.reopenQRCode is registered; it does not exercise ReopenQRCode.baseFn().
- Latest
master contains no dedicated reopenQRCode.test.ts.
- No open issue or open PR currently covers this test gap.
Validation
- Run
npm run build.
- Run the focused
ReopenQRCode test suite.
- Run
npm test and confirm the new tests pass with the existing suite.
Summary
The
ReopenQRCodecommand insrc/extension/commands/reopenQRCode.tshas no dedicated unit tests. Its success path creates an Expo QR Code webview and renders the current QR Code URL, while its failure path throwsFailedToReopenQRCodewhen no URL is available.Why this is useful
Reopening the Expo QR Code is a user-facing command, but its webview contract and missing-URL behavior are currently unguarded. Focused unit tests can cover both paths without launching Expo, creating a real webview, or generating a QR image.
Suggested scope
test/extension/commands/reopenQRCode.test.tsusing the existingproxyquire+ Sinon command-test pattern.getQRCodeUrl,QRCodeContentProvider, and the requiredvscodeAPIs before importing the command module.createWebviewPanelis called with the expected view type, title, column, and options.provideTextDocumentContent, and the returned HTML is assigned to the webview.baseFn()rejects withInternalErrorCode.FailedToReopenQRCodeand no webview is created.Evidence
src/extension/commands/reopenQRCode.tscontains distinct URL-present and URL-missing branches.reactNative.reopenQRCodeis registered; it does not exerciseReopenQRCode.baseFn().mastercontains no dedicatedreopenQRCode.test.ts.Validation
npm run build.ReopenQRCodetest suite.npm testand confirm the new tests pass with the existing suite.