tests: 52 unit tests for cli/config-core.js (fetchRemoteConfig schema validation, writeCache error handling)#321
tests: 52 unit tests for cli/config-core.js (fetchRemoteConfig schema validation, writeCache error handling)#321javimosch wants to merge 1 commit into
Conversation
…Cache, all exports)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 46 minutes and 13 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What changed
Added
__tests__/config-core.test.js— 52 unit tests directly targetingcli/config-core.js.Coverage
fetchRemoteConfig(schema validation)"SUPERCLI_SERVER is not configured"forundefined,null, and""server values<server>/api/config)mcpServers)writeCache(error handling)mkdirSyncwhen dir existsfetchedAttimestamp; returns the written data objectwriteFileSyncerrors to callermkdirSyncerrors when directory cannot be createdmcp_servers(strips null/invalid entries)nullconfig input (falls back toemptyConfigdefaults)mcpServersobject-style intomcp_serversarrayOther exports
readCache: missing file → null; valid file → normalized config; corrupt JSON → null;readFileSyncthrow → nullnormalizeConfig: null input, version passthrough, non-arrayspecs/commandsreplacednormalizeMcpServerEntry: falsy/non-string name, null/array entry, url, args filtering, header stripping,timeout_ms,statefulnormalizeMcpServers: empty config, object-to-array conversion + sort, dedup (array wins), invalid entry skippingloadConfig: no cache fallback, plugin command merging, corrupt cache graceful handlingemptyConfig: correct structure, fresh object per callgetClientId: env var override, stable sha256 hashensureCacheDir: creates dir / skips if presentcacheFilePath: returns correct pathVerification
Closes #419 (mago task #419)