Skip to content

Add unit tests for SessionContextPlugin #116

Description

@fuseraft

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.

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

    .NETPull requests that update .NET codegood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions