test(core): add isRecord unit tests for json-types#5598
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new Vitest test file is added for the ChangesisRecord Tests
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
✨ Thanks for adding the focused Vitest suite for the isRecord type guard in src/lib/core/json-types.ts. This proposes a way to raise coverage on a shared utility used across onboard, policies, and agent-onboard data boundaries with no production code changes. |
cv
left a comment
There was a problem hiding this comment.
Focused isRecord unit coverage is correct and complete. All 35 required checks are green, the exact-head trusted manual PR Review Advisor run found no required, warning, or improvement items, and no major CodeRabbit finding remains.
## Summary Adds a focused unit-test suite for the `isRecord` type guard in `src/lib/core/json-types.ts`, which previously had no co-located test. This raises coverage on a shared utility used across CLI data boundaries (onboard, policies, agent-onboard) with no production code changes. ## Changes - Add `src/lib/core/json-types.test.ts` with Vitest cases for `isRecord`: - returns `true` for plain, empty, and nested objects - returns `false` for `null`, `undefined`, arrays, strings, numbers, and booleans ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [ ] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [ ] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [ ] Docs updated for user-facing behavior changes - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the style guide (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Atulya Singh <atulyarajsingh@gmail.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive test coverage for record validation logic, verifying correct behavior with various input types including objects, null, undefined, arrays, and primitive values. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Adds a focused unit-test suite for the
isRecordtype guard insrc/lib/core/json-types.ts, which previously had no co-located test. This raises coverage on a shared utility used across CLI data boundaries (onboard, policies, agent-onboard) with no production code changes.Changes
src/lib/core/json-types.test.tswith Vitest cases forisRecord:truefor plain, empty, and nested objectsfalsefornull,undefined, arrays, strings, numbers, and booleansType of Change
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Signed-off-by: Atulya Singh atulyarajsingh@gmail.com
Summary by CodeRabbit