Cover AWS_REGION default branch in use()#63
Merged
Conversation
Adds a test that deletes process.env.AWS_REGION before calling env.use(), with a spy SecretsManagerClient that captures the region passed to its constructor. This exercises the `|| 'us-east-1'` fallback that was previously unreached, taking branch coverage on src/index.js to 100%. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the last remaining uncovered branch in
src/index.js: the|| 'us-east-1'fallback inuse()whenprocess.env.AWS_REGIONis unset. Test-only change — no library behavior changes, no version bump.Changed Files
test/test.js— new testuse() defaults region to us-east-1 when AWS_REGION is unset. Uses a local spySecretsManagerClientwhose constructor capturesregion, then deletesprocess.env.AWS_REGIONbefore callingenv.use()and restores it in afinallyblock so subsequent tests (which rely onAWS_REGION) still pass.Steps to Verify
npm run ci— all 131 tests pass.Uncovered Line #sempty and branch coverage at 100% forsrc/index.js(was 98.95% with line 50 flagged).