fix(worker): reuse shared hub fake and guard blank list name
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -4,34 +4,9 @@ using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Worker.External;
|
||||
using ClaudeDo.Worker.Hub;
|
||||
using ClaudeDo.Worker.Tests.Infrastructure;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace ClaudeDo.Worker.Tests.External;
|
||||
|
||||
internal sealed class ListToolsHubClients : IHubClients
|
||||
{
|
||||
public ListToolsClientProxy Proxy { get; } = new();
|
||||
public IClientProxy All => Proxy;
|
||||
public IClientProxy AllExcept(IReadOnlyList<string> e) => Proxy;
|
||||
public IClientProxy Client(string c) => Proxy;
|
||||
public IClientProxy Clients(IReadOnlyList<string> c) => Proxy;
|
||||
public IClientProxy Group(string g) => Proxy;
|
||||
public IClientProxy GroupExcept(string g, IReadOnlyList<string> e) => Proxy;
|
||||
public IClientProxy Groups(IReadOnlyList<string> g) => Proxy;
|
||||
public IClientProxy User(string u) => Proxy;
|
||||
public IClientProxy Users(IReadOnlyList<string> u) => Proxy;
|
||||
}
|
||||
internal sealed class ListToolsClientProxy : IClientProxy
|
||||
{
|
||||
public Task SendCoreAsync(string m, object?[] a, CancellationToken ct = default) => Task.CompletedTask;
|
||||
}
|
||||
internal sealed class ListToolsHubContext : IHubContext<WorkerHub>
|
||||
{
|
||||
public ListToolsHubClients RecordingClients { get; } = new();
|
||||
public IHubClients Clients => RecordingClients;
|
||||
public IGroupManager Groups => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public sealed class ListMcpToolsTests : IDisposable
|
||||
{
|
||||
private readonly DbFixture _db = new();
|
||||
@@ -43,7 +18,7 @@ public sealed class ListMcpToolsTests : IDisposable
|
||||
{
|
||||
_ctx = _db.CreateContext();
|
||||
_lists = new ListRepository(_ctx);
|
||||
_sut = new ListMcpTools(_lists, new HubBroadcaster(new ListToolsHubContext()));
|
||||
_sut = new ListMcpTools(_lists, new HubBroadcaster(new CapturingHubContext()));
|
||||
}
|
||||
|
||||
public void Dispose() { _ctx.Dispose(); _db.Dispose(); }
|
||||
|
||||
Reference in New Issue
Block a user