Repository navigation
test(downgrader): cover rejectsNull and null branch checks in 3.1 to 3.0 nullable merge - #90
Conversation
…3.0 nullable merge Stryker left these checks from #87/#88 untested: a `$ref` to a `type: "null"` target or an array `type`, a typed branch with `oneOf`, and a null branch with extra keys. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KnRgKQZ6Maz5HiVMYr9twz
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — test-only addition to the 3.1→3.0 behavior suite; no source changes.
oneOfbranch guard — adds{ type: 'string', oneOf: [...] }to the typed branch loop, pinning thatoneOfinNOT_NULLABLE_KEYWORDSkeeps the pair asoneOfinstead of merging tonullable.- Non-trivial null branch — asserts
{ type: 'null', description: 'd' }is not treated as only-null, so theanyOfstays put (covers the key count inisOnlyNullSchema). - Array
typerejects null — addspet({ type: ['object', 'string'] })expectingoneOf; this is the only test exercising that an arraytypewithout"null"rejects null. type: 'null'does not reject — addspet({ type: 'null' })expecting the pair to stayanyOf.
I verified the coverage is not theater: all 84 tests pass, uncheck (oxlint/oxfmt/tsc) is clean on the changed file, and hand-applying each of the four claimed mutations to packages/downgrader/src/v3.1-to-v3.0.ts makes the corresponding new expectation fail (removing 'oneOf' from NOT_NULLABLE_KEYWORDS; widening isOnlyNullSchema's length === 3 to >= 3; forcing the rejectsNull array branch to reject nothing; dropping && type !== 'null' from the string branch). The source was restored — working tree is clean.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Requested by dinwwwh · project thread
Test-only. Stryker on main left mutants alive in the checks #87/#88 added to the 3.1 to 3.0 nullable merge. This adds expectations to the existing tests in
tests/v3.1-to-v3.0.test.ts; main already gives the right output for each one.anyOfof a$refto atype: "null"target and null staysanyOf. This coversrejectsNullletting"null"through.anyOfof a$refto atype: ["object", "string"]target and null becomesoneOf. This covers the arraytypecase ofrejectsNull.oneOfbeside null is not merged and becomes aoneOfpair. This coversoneOfinNOT_NULLABLE_KEYWORDS.descriptionis not treated as only null, so theanyOfstays as it is. This covers the key count inisOnlyNullSchema.I applied each of those four mutations by hand. All of them pass the tests on main and fail with this change.
Generated by Claude Code