Skip to content

tests: unit-test plugins-store exports and normalizeMcpServerEntry edge cases#318

Open
javimosch wants to merge 1 commit into
masterfrom
mago/task-413
Open

tests: unit-test plugins-store exports and normalizeMcpServerEntry edge cases#318
javimosch wants to merge 1 commit into
masterfrom
mago/task-413

Conversation

@javimosch

Copy link
Copy Markdown
Owner

What changed

__tests__/plugins-store.test.js — extended with 16 new tests covering the six exports that were previously untested:

  • readServerPluginsLock — valid lock, invalid JSON, null installed, string installed, missing file
  • writeServerPluginsLock — ensures dir creation and writes to correct path, returns the lock
  • listServerInstalledPlugins — populated and empty cases
  • getPlugin — found by name, not found, missing file
  • getServerPluginCommands — flattened from server plugins, empty when lock absent

__tests__/config-core.test.js — new file, 26 tests for normalizeMcpServerEntry (cli/config-core.js):

  • Name validation: null, empty string, number, undefined → all return null
  • Entry validation: null, array, string, undefined → all return null
  • Field inclusion: url, command included only when string-typed
  • args / commandArgs: only string elements pass the filter; non-array omitted
  • headers / env: non-string values dropped; array type omitted entirely
  • timeout_ms: positive number included; zero, negative, string omitted
  • stateful: true included; "true", false omitted
  • Combined full-entry round-trip

Why

Task #413 identified that plugins-store.js had only partial test coverage (11 tests, missing server-side functions and inner readLockFile edge cases) and that normalizeMcpServerEntry — a filter used on every config load — had no tests at all.

Verification

npx jest __tests__/plugins-store.test.js __tests__/config-core.test.js --no-coverage
# Tests: 53 passed, 53 total

Closes #413 (mago task #413)

Expands __tests__/plugins-store.test.js with coverage for the six
previously-untested exports (readServerPluginsLock, writeServerPluginsLock,
listServerInstalledPlugins, getPlugin, getServerPluginCommands, and further
readLockFile edge cases: invalid JSON, null installed, string installed).

Adds __tests__/config-core.test.js to unit-test normalizeMcpServerEntry
(config-core.js) across all its validation branches: name/entry type guards,
url/command inclusion, args/commandArgs non-string filtering, headers/env
non-string-value filtering, timeout_ms sign/type checks, and the stateful
strict-true guard.

53 tests total, all passing.

mago task #413
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@javimosch, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 6 minutes and 47 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4ff6266f-1729-4c5c-9379-0ec9b9ebe3a4

📥 Commits

Reviewing files that changed from the base of the PR and between afda2f7 and 5f04da3.

📒 Files selected for processing (2)
  • __tests__/config-core.test.js
  • __tests__/plugins-store.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mago/task-413

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.

❤️ Share

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

@javimosch

Copy link
Copy Markdown
Owner Author

Review — Head of Org Engineering: The diff adds only new test files/cases covering normalizeMcpServerEntry and server-side plugins-store functions, with no production code changes, no secrets, no destructive edits, and valid parseable JavaScript. All five merge criteria are satisfied.

(approved — review-only mode; merge when ready.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant