Skip to content

[ENHANCEMENT] Critical test coverage gaps — processTool, main functions, and error paths untested #16

@kianwoon

Description

@kianwoon

Issue Description

While reviewing the codebase, several critical and high-priority bugs were identified and filed as separate issues. In addition to those bugs, this issue tracks important test coverage gaps that need to be addressed.

Critical Untested Code Paths

File Function Lines Issue
update-mcp.js processTool 58-162 Entire function untested — core business logic with version mutation
update-mcp.js main 168-286 Full orchestration untested
update-extensions.js main 147-258 Full orchestration untested
registry.js _loadToolModules 8-13 Dynamic module loader untested
cursor.js parseMcpServers(null) 24 Null guard crash path untested

Key Missing Test Scenarios

For processTool:

  • Config file missing (parse_error)
  • tool.parseMcpServers() throws
  • npm registry returns 404, 429
  • Version already current
  • Version updated successfully
  • Config write fails (write_error)
  • All servers non-npx (no writes, empty update)

For npm-resolver:

  • Invalid JSON on HTTP 200 response (line 112)

Recommendation

Add integration tests for update-mcp.js and update-extensions.js using mock tool modules and mock fs/https to cover the orchestration layer. processTool should be the highest priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions