tests: unit-test config-mcp.js setMcpServer/removeMcpServer persistence logic#319
tests: unit-test config-mcp.js setMcpServer/removeMcpServer persistence logic#319javimosch wants to merge 1 commit into
Conversation
22 tests covering: - setMcpServer upsert: insert-new, update-existing, string→url, object merge, headers/env, null-value bare entry, throws code-85 on empty name, return value, write-to-cache - dedup via normalizeMcpServers: deduplicate same-name (last-wins), sorted alpha output, null/invalid entries stripped, numeric name dropped - removeMcpServer persistence: removes named entry returns true, cache file updated, single-of-many removal - remove-missing no-op: returns false for absent name, for missing field, for missing cache, for empty array Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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 33 minutes and 59 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 |
|
Review — Head of Org Engineering: The diff adds a new test file (approved — review-only mode; merge when ready.) |
What changed
Added
__tests__/config-mcp.test.js— 22 unit tests that directly exercisecli/config-mcp.js(setMcpServerandremoveMcpServer) in isolation, mockingfs,os, andplugins-store.Why
config.test.jscovers these functions only through thecli/config.jsproxy. This new file testsconfig-mcp.jsas a standalone unit, focusing on the persistence contract (what is read from and written to the cache file) rather than the higher-level config facade.Coverage
setMcpServer— upserturlfieldnameheadersandenvfields passed throughnull/non-object value → bare{ name }entry{ code: 85, type: "invalid_argument" }on empty namemcp_serverswriteFileSynccalled with correct pathDedup via
normalizeMcpServersnamenull/undefineditems in stored list are strippednameare droppedremoveMcpServer— persistencetrueand removes the named entrywriteFileSynccalled; cache contains the reduced listremoveMcpServer— missing-server no-opfalsewhen server name not presentfalsewhenmcp_serversfield missing from configfalsewhen cache file is absentfalsewhenmcp_serversis an empty arrayVerified
Closes #416 (mago task #416)