Skip to content

Add unit tests for JsonPlugin #102

Description

@fuseraft

src/Infrastructure/Plugins/JsonPlugin.cs is a self-contained plugin (no constructor dependencies — nothing to mock) that exposes JSON utilities to agents: Format, Minify, Get, Keys, Search, Merge, ToText, Validate. It's documented in docs/plugins.md but has no dedicated test file under tests/FuseraftCli.Tests/. The only existing reference to it in the test suite is PluginCapabilityMapCoverageTests.cs, which just checks that the plugin is registered — it doesn't exercise any of the actual behavior.

Task

Add tests/FuseraftCli.Tests/JsonPluginTests.cs covering the public methods above. Suggested cases:

  • Get with a plain dot path, a bracket-array path (e.g. items[2]), and a path that doesn't exist
  • Merge where the patch overrides some base keys and adds new ones
  • Search finding a nested key match and the "not found" case
  • Format / Minify / Validate on both valid and invalid JSON strings
  • Keys on an object, an array, and a scalar
  • ToText on a small nested object

Acceptance criteria

  • Each public method has at least one happy-path test and one edge-case test (invalid input, empty object/array, or missing path).
  • ./build.sh --target=Test passes.
  • Follow the conventions in CONTRIBUTING.md (one file per class, no ILogger mocks needed here since the class takes none).

Good first issue — no orchestration or plugin-registration knowledge required, just the JSON utility methods themselves.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions