Skip to content

test(core): add isRecord unit tests for json-types#5598

Merged
cv merged 1 commit into
NVIDIA:mainfrom
atulya-singh:test/core-json-types-isrecord
Jul 7, 2026
Merged

test(core): add isRecord unit tests for json-types#5598
cv merged 1 commit into
NVIDIA:mainfrom
atulya-singh:test/core-json-types-isrecord

Conversation

@atulya-singh

@atulya-singh atulya-singh commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

  • 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

  • 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)
  • Tests added or updated for new or changed behavior
  • 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

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.

@copy-pr-bot

copy-pr-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a5090e95-b6a0-442c-8ed3-c728473bf4ee

📥 Commits

Reviewing files that changed from the base of the PR and between c256f8f and c2a9ce4.

📒 Files selected for processing (1)
  • src/lib/core/json-types.test.ts

📝 Walkthrough

Walkthrough

A new Vitest test file is added for the isRecord utility. It covers true cases (empty object, plain object, nested object) and false cases (null, undefined, arrays, strings, numbers, and booleans).

Changes

isRecord Tests

Layer / File(s) Summary
isRecord test cases
src/lib/core/json-types.test.ts
Adds a describe("isRecord") suite with it(...) cases asserting true for plain/nested objects and false for null, undefined, arrays, and primitive types.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A bunny hopped in to check each type,
Is it a record? Is the object ripe?
Null says no, arrays disagree,
But plain little objects? Yes, those are free!
🐇 All tests pass — hop hop hooray! ✅

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding unit tests for the isRecord function in json-types, which is the sole focus of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@wscurran wscurran added area: architecture Architecture, design debt, major refactors, or maintainability chore Build, CI, dependency, or tooling maintenance labels Jun 23, 2026
@wscurran

Copy link
Copy Markdown
Contributor

✨ 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.

@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure and removed area: architecture Architecture, design debt, major refactors, or maintainability labels Jun 23, 2026
@cv cv added the v0.0.76 Release target label Jul 7, 2026

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cv
cv merged commit 5dc94b8 into NVIDIA:main Jul 7, 2026
35 of 37 checks passed
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
## 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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance v0.0.76 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants