test: add --ca-cert coverage to validate.test.ts#587
Open
AbhishekNagar07 wants to merge 1 commit into
Open
Conversation
Added unit tests to cover the --ca-cert validation branch. Added cases to ensure it throws with a '--ca-cert:' prefix for invalid/missing files, and does not throw when the flag is omitted. Resolves OWASP#511.
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.
Resolves #511.
Summary
Added missing unit test coverage for the
--ca-certCLI flag validation logic.Why this change
PR #464 added the core unit tests for
src/cli/validate.tsbut missed the specific branch testing the--ca-certvalidation (lines 29-35). This PR completes that test coverage as requested by the maintainer.What changed
describeblock for--ca-cert validationinvalidate.test.ts.validateOptionsthrows an error with a--ca-cert:prefix when an invalid certificate path is provided.validateOptionsdoes not throw when the--ca-certflag is entirely omitted.Validation
Added the required test blocks to
validate.test.ts. The tests explicitly verify the error-wrapping behavior and the safe-pass behavior of thecaCertoption according to the issue specifications.User-facing impact
Does this change:
Note: None of the above apply. This is purely an internal code-coverage improvement.
Notes
Thank you for providing this issue! Let me know if any adjustments are needed.