fuseraft / fuseraft/fuseraft-cli
Add unit tests for SessionContextPlugin
- Dominant language
- C#
- Stars
- 4
- Forks
- 4
- Avg merge
- 22h 54m
- Merged PRs (30d)
- 11
Description
`SessionContextPlugin` (https://github.com/fuseraft/fuseraft-cli/blob/main/src/Infrastructure/Plugins/SessionContextPlugin.cs) has no test file — there is no `SessionContextPluginTests.cs` under `tests/FuseraftCli.Tests/`.
It's a small read/write handoff-notes plugin backed by a single plain-text file, with a character-count truncation cap (`maxChars`, default 8,000). It's the simplest of the untested plugins in `src/Infrastructure/Plugins/` — no manager/store dependency, just a file path — so it's a good entry point for a first PR.
Good first areas to cover:
- `ReadAsync` when the file doesn't exist yet returns the "no session context summary yet" info message
- `ReadAsync` on an empty file returns "Session context summary is empty."
- `WriteAsync` then `ReadAsync` round-trips the trimmed summary text
- `WriteAsync` rejects an empty/whitespace-only summary (`PluginResult.Error`)
- `WriteAsync` creates the parent directory if it doesn't exist yet
- `ReadAsync` truncates content longer than `maxChars` and appends the "[session context truncated — N chars omitted...]" note, using the exact omitted-char count
- Passing `maxChars: 0` disables truncation even for long content
`SelfPluginTests.cs` or `ArtifactPluginTests.cs` (in the same `tests/FuseraftCli.Tests/` directory) are good references for testing a small file-backed plugin like this one.
Contributor guide
Research direction
Start with src/Infrastructure/Plugins/SessionContextPlugin.cs, then read SelfPluginTests.cs or ArtifactPluginTests.cs in tests/FuseraftCli.Tests/ for the local testing pattern. Add SessionContextPluginTests.cs covering the listed read, write, directory, trimming, truncation, and maxChars cases; done means the tests pass and verify the exact messages and omitted-character count.
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
- 88/100