Skip to content

test: add --ca-cert coverage to validate.test.ts#587

Open
AbhishekNagar07 wants to merge 1 commit into
OWASP:mainfrom
AbhishekNagar07:patch-1
Open

test: add --ca-cert coverage to validate.test.ts#587
AbhishekNagar07 wants to merge 1 commit into
OWASP:mainfrom
AbhishekNagar07:patch-1

Conversation

@AbhishekNagar07

Copy link
Copy Markdown

Resolves #511.

Summary

Added missing unit test coverage for the --ca-cert CLI flag validation logic.

Why this change

PR #464 added the core unit tests for src/cli/validate.ts but missed the specific branch testing the --ca-cert validation (lines 29-35). This PR completes that test coverage as requested by the maintainer.

What changed

  • Added a describe block for --ca-cert validation in validate.test.ts.
  • Added a test case ensuring validateOptions throws an error with a --ca-cert: prefix when an invalid certificate path is provided.
  • Added a test case ensuring validateOptions does not throw when the --ca-cert flag 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 the caCert option according to the issue specifications.

User-facing impact

Does this change:

  • affect scanning behavior
  • affect output formatting
  • affect JSON output
  • affect docs only

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add --ca-cert coverage to validate.test.ts

1 participant