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:
47
tests/ClaudeDo.Worker.Tests/Hub/AgentSettingsHubTests.cs
Normal file
47
tests/ClaudeDo.Worker.Tests/Hub/AgentSettingsHubTests.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user