Skip to content

test(cloud): improve coverage for utils.ts and config.ts#3

Open
easonLiangWorldedtech wants to merge 2 commits into
mainfrom
fix-coverage-cloud-config-utils-20260710
Open

test(cloud): improve coverage for utils.ts and config.ts#3
easonLiangWorldedtech wants to merge 2 commits into
mainfrom
fix-coverage-cloud-config-utils-20260710

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner

Summary

This PR improves test coverage in packages/cloud by adding tests for previously uncovered files.

Changes

  • **Added utils.spec.ts\** — 5 tests covering getUserAgent()`:

    • No context provided (returns 'Zoo-Code unknown')
    • Valid extension version from packageJSON.version
    • Missing packageJSON.version field
    • Undefined extension object
    • Undefined packageJSON object
  • **Added config.spec.ts\** — 6 tests covering getClerkBaseUrl()andgetRooCodeApiUrl()`:

    • Default production URLs when no env vars set
    • Custom URL from CLERK_BASE_URL / ROO_CODE_API_URL env vars
    • Fallback behavior for empty string env values

Coverage Impact

File Before (FNF/FNH) After
utils.ts 1/0 1/1 (+100%)
config.ts 2/1 2/2 (+50%)

Tests

  • All 258 cloud tests pass (including 11 new ones)
  • No regressions in existing test suite

- Add 5 tests for getUserAgent() in utils.spec.ts covering all code paths
  (no context, valid version, missing version, undefined extension)
- Add 6 tests for getClerkBaseUrl() and getRooCodeApiUrl() in config.spec.ts
  covering env var overrides and fallback behavior

This brings coverage on previously uncovered files:
- utils.ts: FNF 0->1 (getUserAgent now covered)
- config.ts: FNF 2->2 with both functions tested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants