feat(worker): add hub methods for list and task agent settings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mika Kuns
2026-04-22 13:16:46 +02:00
parent 480eb0817a
commit 7c312161bb
3 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Repositories;
using ClaudeDo.Worker.Tests.Infrastructure;
using Xunit;
namespace ClaudeDo.Worker.Tests.Hub;
public sealed class AgentSettingsHubTests : IDisposable
{
private readonly DbFixture _db = new();
private readonly ClaudeDo.Data.ClaudeDoDbContext _ctx;
private readonly ListRepository _repo;
public AgentSettingsHubTests()
{
_ctx = _db.CreateContext();
_repo = new ListRepository(_ctx);
}
public void Dispose()
{
_ctx.Dispose();
_db.Dispose();
}
[Fact]
public async Task UpdateListConfig_AllNull_DeletesRow()
{
var listId = Guid.NewGuid().ToString();
await _repo.AddAsync(new ListEntity { Id = listId, Name = "L", CreatedAt = DateTime.UtcNow });
await _repo.SetConfigAsync(new ListConfigEntity
{
ListId = listId, Model = "opus", SystemPrompt = null, AgentPath = null,
});
string? model = null, sp = null, ap = null;
if (model is null && sp is null && ap is null)
await _repo.DeleteConfigAsync(listId);
else
await _repo.SetConfigAsync(new ListConfigEntity
{
ListId = listId, Model = model, SystemPrompt = sp, AgentPath = ap,
});
Assert.Null(await _repo.GetConfigAsync(listId));
}
}