refactor(worker): remove MessageParser (replaced by StreamAnalyzer)

This commit is contained in:
Mika Kuns
2026-04-14 14:12:21 +02:00
parent 03728c8e4a
commit c1c4c75979
26 changed files with 3978 additions and 88 deletions

View File

@@ -0,0 +1,41 @@
# ClaudeDo.Worker.Tests
xUnit integration tests for the Worker and Data layers.
## Framework
- xUnit 2.5.3 with `xunit.runner.visualstudio`
- No mocking library — custom sealed fakes (FakeClaudeProcess, FakeHubContext, FakeHubClients, FakeClientProxy)
- Real SQLite databases per test via `DbFixture`
- Real git repos for worktree tests via `GitRepoFixture`
- coverlet for coverage collection
## Test Infrastructure
- **DbFixture** — creates unique temp SQLite DB, applies schema, cleans up DB + WAL/SHM files on dispose
- **GitRepoFixture** — creates temp git repo with initial commit, configures user/email, handles Windows read-only .git cleanup. Tests skip if git is unavailable.
## Test Areas
| Area | File | What it covers |
|------|------|----------------|
| Repositories | `ListRepositoryTests` | CRUD, tag junctions |
| | `TaskRepositoryTests` | CRUD, status transitions, agent tag filtering, effective tags, stale flip |
| Runner | `WorktreeManagerTests` | Worktree creation, commit detection, error on non-git dir |
| | `CommitMessageBuilderTests` | Slug generation, title/description truncation |
| | `MessageParserTests` | NDJSON parsing, malformed input |
| Services | `QueueServiceTests` | FIFO ordering, override slot contention, cancellation, active tracking |
| | `StaleTaskRecoveryTests` | Flips orphaned running tasks to failed |
## Conventions
- Test classes implement `IDisposable` and create fixtures in constructor
- Helper factory methods for entities: `MakeTask()`, `CreateListAsync()`, `SeedListWithAgentTag()`
- Concurrency tests use `TaskCompletionSource` as gates for deterministic ordering
- Git-dependent tests are conditionally skipped via `Skip = ...` when git is not available
## Running
```bash
dotnet test tests/ClaudeDo.Worker.Tests
```