fuseraft / fuseraft/fuseraft-cli
Add unit tests for ScratchpadPlugin
- Dominant language
- C#
- Stars
- 4
- Forks
- 4
- Avg merge
- 22h 54m
- Merged PRs (30d)
- 11
Description
`ScratchpadPlugin` (https://github.com/fuseraft/fuseraft-cli/blob/main/src/Infrastructure/Plugins/ScratchpadPlugin.cs) has no test file — there is no `ScratchpadPluginTests.cs` under `tests/FuseraftCli.Tests/`.
The plugin gives agents a small per-session JSON key/value store (`WriteAsync`, `ReadAsync`, `ReadAllAsync`, `SearchAsync`, `DeleteAsync`), scoped either to the current agent or shared via a `global` scope, backed by a JSON file at `{BasePath}/{AgentName}.json` (or `{BasePath}/global.json`). It's fully self-contained — no AI client or network mocking needed, just a temp directory.
Good first areas to cover:
- Write then read round-trips a value, including tags
- Read of a missing key returns the `[NOT FOUND]` message
- `ReadAllAsync` on an empty scratchpad returns `[EMPTY]`
- `SearchAsync` matches on key, value, and tag substrings (case-insensitively)
- `DeleteAsync` removes an entry and returns `[NOT FOUND]` on a second delete
- `agent` vs `global` scope write to different files and don't leak into each other
- A corrupted/invalid JSON file on disk falls back to an empty scratchpad rather than throwing (see the `catch` in `LoadAsync`)
`JsonPluginTests.cs` and `TodoPluginTests.cs` (in the same `tests/FuseraftCli.Tests/` directory) are good references for the file-backed-plugin test pattern used in this repo.
Contributor guide
Research direction
Start with src/Infrastructure/Plugins/ScratchpadPlugin.cs and use tests/FuseraftCli.Tests/JsonPluginTests.cs and TodoPluginTests.cs as file-backed test references. Create ScratchpadPluginTests.cs using a temporary directory, covering round-trips, missing and empty results, search, deletion, scope isolation, and invalid JSON fallback. Done means the tests pass and exercise the listed behavior without network or AI-client mocking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100