Skip to content

test(cli): table-drive utility specs#4927

Merged
cv merged 1 commit into
mainfrom
codex/table-drive-utility-tests
Jun 8, 2026
Merged

test(cli): table-drive utility specs#4927
cv merged 1 commit into
mainfrom
codex/table-drive-utility-tests

Conversation

@cv

@cv cv commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Refactors repeated pure utility specs into it.each tables so the input and expected-result matrices are easier to scan. The change keeps behavior coverage equivalent while reducing duplicated test bodies.

Changes

  • Table-drives parsePort valid and invalid cases in src/lib/core/ports.test.ts.
  • Table-drives duration parsing and rejection cases in src/lib/domain/duration.test.ts.
  • Table-drives errno and permission-error classification cases in src/lib/core/errno.test.ts.
  • Table-drives URL normalization, loopback hostname, and policy preset env parsing cases in src/lib/core/url-utils.test.ts.

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

  • npx prek run --all-files passes
  • npm test passes
  • 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: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Tests
    • Refactored test suites to use parameterized table-driven testing approach, improving test organization and maintainability across core utility and domain modules.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this Jun 8, 2026
@coderabbitai

coderabbitai Bot commented Jun 8, 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: 3daa63d3-5ade-4c52-92ab-30bdc338e965

📥 Commits

Reviewing files that changed from the base of the PR and between 5aa2c95 and c02c337.

📒 Files selected for processing (4)
  • src/lib/core/errno.test.ts
  • src/lib/core/ports.test.ts
  • src/lib/core/url-utils.test.ts
  • src/lib/domain/duration.test.ts

📝 Walkthrough

Walkthrough

This PR refactors four utility test files to use Vitest's it.each table-driven testing instead of individual it(...) blocks. The same test cases are preserved in parametrized tables for error type guards, port parsing, URL utilities, and duration parsing.

Changes

Test Refactoring to Table-Driven Tests

Layer / File(s) Summary
errno type guards refactored to it.each tables
src/lib/core/errno.test.ts
isErrnoException and isPermissionError test suites converted to parametrized it.each tables covering error/object code/errno combinations, invalid values, and permission classifications.
parsePort validation refactored to it.each tables
src/lib/core/ports.test.ts
parsePort valid and invalid cases consolidated into two it.each tables: one for fallback/numeric/bounds scenarios and one for rejection of non-numeric/out-of-range/special-character inputs.
URL utilities refactored to it.each tables
src/lib/core/url-utils.test.ts
normalizeProviderBaseUrl, isLoopbackHostname, and parsePolicyPresetEnv test suites converted to parametrized it.each tables covering suffix stripping, localhost variants, and comma-separated input filtering.
parseDuration validation refactored to it.each tables
src/lib/domain/duration.test.ts
parseDuration successful and error-case tests consolidated into two parametrized it.each tables covering trimming, case-insensitivity, and rejection of invalid/empty/zero/over-maximum inputs.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through test files with glee,
Converting cases to tables, so neat and so free,
Each parameter dances in rows, each design,
The same coverage remains—refactored divine!

🚥 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 'test(cli): table-drive utility specs' accurately describes the main change: refactoring multiple test files to use table-driven tests (it.each) for utility functions.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/table-drive-utility-tests

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

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: None

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No E2E is recommended because this PR only refactors unit tests while preserving the same covered behavior and does not change runtime code or real assistant user flows.

Optional E2E

  • None.

New E2E recommendations

  • None.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

E2E Scenario Advisor Recommendation

Required scenario E2E: None
Optional scenario E2E: None

Workflow run

Full scenario advisor summary

E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required scenario E2E

  • None. Changes are limited to unit test files outside test/e2e-scenario/ and do not affect scenario E2E runtime, workflows, metadata, suites, or scenario-relevant helpers.

Optional scenario E2E

  • None.

Relevant changed files

  • None.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 0 worth checking, 0 nice ideas
Top item: No actionable findings

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

@cv cv merged commit 4307f43 into main Jun 8, 2026
39 checks passed
@cv cv deleted the codex/table-drive-utility-tests branch June 8, 2026 01:52
@cv cv added the v0.0.61 Release target label Jun 8, 2026
@wscurran wscurran added the chore Build, CI, dependency, or tooling maintenance label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI, dependency, or tooling maintenance v0.0.61 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants