test(worker): consolidate fakes into Infrastructure/, drop tag-era names
- Extract FakeClaudeProcess to Infrastructure/FakeClaudeProcess.cs (was defined inline in QueueServiceTests #region); all consumers updated - Replace duplicate FakeHubContext/FakeHubClients/FakeClientProxy (QueueServiceTests) with existing CapturingHubContext from Infrastructure across all 7 affected files; Planning's file-local FakeHubContext kept - Rename SeedListWithAgentTag → SeedListAsync (return Task<string>, drop unused agentTagId tuple element) and SeedListWithAgentTagAsync → SeedListAsync - PrimeRunnerTests keeps its private nested FakeClaudeProcess: constructor API (delay/exitCode/lines/result params) differs from the shared one and replacement would require rewriting every test in that file Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,6 @@ using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Worker.Hub;
|
||||
using ClaudeDo.Worker.Runner;
|
||||
using ClaudeDo.Worker.Tests.Infrastructure;
|
||||
using ClaudeDo.Worker.Tests.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
|
||||
using Xunit;
|
||||
@@ -38,7 +37,7 @@ public sealed class SuggestImprovementTests : IDisposable
|
||||
await SeedCallerAsync("caller", parentId: null);
|
||||
using var ctx = _db.CreateContext();
|
||||
var svc = new TaskRunMcpService(new TaskRepository(ctx), AccessorFor("caller"),
|
||||
new HubBroadcaster(new FakeHubContext()));
|
||||
new HubBroadcaster(new CapturingHubContext()));
|
||||
var dto = await svc.SuggestImprovement("Refactor X", "details", model: null, default);
|
||||
var child = await new TaskRepository(ctx).GetByIdAsync(dto.ChildTaskId);
|
||||
Assert.Equal("caller", child!.ParentTaskId);
|
||||
@@ -54,7 +53,7 @@ public sealed class SuggestImprovementTests : IDisposable
|
||||
await SeedCallerAsync("caller", parentId: null);
|
||||
using var ctx = _db.CreateContext();
|
||||
var svc = new TaskRunMcpService(new TaskRepository(ctx), AccessorFor("caller"),
|
||||
new HubBroadcaster(new FakeHubContext()));
|
||||
new HubBroadcaster(new CapturingHubContext()));
|
||||
var dto = await svc.SuggestImprovement("Refactor X", "details", model: "HAIKU", default);
|
||||
var child = await new TaskRepository(ctx).GetByIdAsync(dto.ChildTaskId);
|
||||
Assert.Equal("haiku", child!.Model);
|
||||
@@ -66,7 +65,7 @@ public sealed class SuggestImprovementTests : IDisposable
|
||||
await SeedCallerAsync("caller", parentId: null);
|
||||
using var ctx = _db.CreateContext();
|
||||
var svc = new TaskRunMcpService(new TaskRepository(ctx), AccessorFor("caller"),
|
||||
new HubBroadcaster(new FakeHubContext()));
|
||||
new HubBroadcaster(new CapturingHubContext()));
|
||||
await Assert.ThrowsAsync<ArgumentException>(
|
||||
() => svc.SuggestImprovement("x", "y", model: "gpt4", default));
|
||||
}
|
||||
@@ -78,7 +77,7 @@ public sealed class SuggestImprovementTests : IDisposable
|
||||
await SeedCallerAsync("child", parentId: "parent");
|
||||
using var ctx = _db.CreateContext();
|
||||
var svc = new TaskRunMcpService(new TaskRepository(ctx), AccessorFor("child"),
|
||||
new HubBroadcaster(new FakeHubContext()));
|
||||
new HubBroadcaster(new CapturingHubContext()));
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => svc.SuggestImprovement("nested", "x", model: null, default));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user