[Issue #353] Expand CLI check spec unit tests#507
[Issue #353] Expand CLI check spec unit tests#507bryan-thompsoncodes wants to merge 4 commits intoHHS:mainfrom
Conversation
Add 10 new tests covering validation scenarios documented in the check command README that were previously untested: - Schema: simple type match, enum match, base extra enums, missing optional prop, default additionalProperties - Routes: extra status codes, extra/missing mime types, extra/missing optional query params
Rename tests that document behavior diverging from the README spec to explicitly note the deviation, and add TODO comments linking to the specific README cases so the tests get updated when the impl is fixed.
|
@bryan-thompsoncodes looks like some of the CI checks failed, could you run those locally and push up any changes? I'll look into the PR: Labeler |
|
@jcrichlake absolutely, looks like I missed a prettier cleanup. Showing all green locally now |
Needs the pull_request_target: trigger to access the right permissions For more details see: actions/labeler#399
|
Since the remaining failure is an Similarly I updated the PR labeler in this commit: ci: Updates event trigger for PR labeler So it's no longer failing, but unfortunately won't run until that commit is merged into |
Summary
Changes proposed
Added 10 new unit tests covering validation scenarios documented in the check command README that were previously untested:
check-schema-compatibility.test.ts(5 tests):additionalPropertiesis not set → flags errorcheck-matching-routes.test.ts(5 tests):Context for reviewers
This PR only adds tests — no source code was changed. All 119 tests pass (up from 109).
The tests were identified by auditing the validation cases in
lib/cli/src/commands/check/README.mdagainst the existing test suite to find gaps. Each new test follows the existing Arrange/Act/Assert pattern and uses the// ############section header convention already established in the test files.Behavioral notes discovered during testing:
A few tests document cases where the current implementation diverges from the README spec. These are worth noting for future work:
should not error when missing property is optionalshould flag missing optional query parametershould not flag extra query parametersadditionalPropertiesundefined → allow extrasEXTRA_FIELDerrorshould allow extra properties when additionalProperties is not setThese may warrant follow-up issues for aligning the implementation with the README spec.
Verification:
npm test (from lib/cli)
Test Suites: 18 passed, 18 total
Tests: 119 passed, 119 total
Additional information
No screenshots needed — test-only change. The coverage report remains stable at 88% statement coverage overall.