Fix/issue 461#464
Conversation
|
Hey Mohammad, great work on the test coverage - exactly the kind of thing this file needed. Two quick things before we can merge: The branch has fallen behind main and has merge conflicts - could you rebase against Also, could you add |
a24ef4e to
487d226
Compare
|
Done — rebased onto main and added Closes #461 to the PR body. Thanks for the quick review! |
e24d51a to
d412ef9
Compare
|
Sorry for the continued back-and-forth — we've merged several PRs since you last rebased and conflicts have crept back in. Could you run |
Adds tests/validate.test.ts covering all five validation branches in validateOptions(): offline+osv-url conflict, no-cache+offline conflict, invalid osv-url format, fix+json conflict, and report+json conflict. Also covers valid option combinations that must not throw. Brings coverage for src/cli/validate.ts from 0% to 100%. Closes OWASP#461
d412ef9 to
a4805c5
Compare
|
No issue, your request is done. Always ready to help. |
Adds tests/validate.test.ts covering all five validation branches in validateOptions(): offline+osv-url conflict, no-cache+offline conflict, invalid osv-url format, fix+json conflict, and report+json conflict. Also covers valid option combinations that must not throw. Brings coverage for src/cli/validate.ts from 0% to 100%. Closes OWASP#461 Co-authored-by: MohammadYusif <MohammadYusif@users.noreply.github.com>
Closes #461
Summary
Adds
tests/validate.test.tswith 13 unit tests covering every validation branch insrc/cli/validate.ts. The file had no dedicated tests before this PR.Why this change
src/cli/validate.tswas recently extracted fromsrc/index.tsto centralize CLI flag compatibility checks. Despite containing several distinct error branches, it had 0% test coverage. Any regression in flag validation would go undetected.What changed
tests/validate.test.tswith one test per incompatible flag combination--offline/--offline-db+--osv-url,--no-cache+--offline/--offline-db, invalid--osv-urlformat,--fix+--json,--report+--jsonValidation
npm test— 348/348 tests pass (up from 335)User-facing impact
No behavior change. Tests only.
Notes
Each
itblock asserts the exact error message string so future wording changes are caught immediately. A smallopts()helper at the top of the file fills required fields (failOn,batchSize) so individual tests only declare the flags they care about.