feat(prime): carry the action kind through the hub and validate custom prompts

This commit is contained in:
mika kuns
2026-08-25 08:51:37 +02:00
parent cf6a6b6208
commit 4e8e0334b2
4 changed files with 62 additions and 4 deletions
@@ -0,0 +1,38 @@
using ClaudeDo.Data.Models;
using ClaudeDo.Worker.Prime;
namespace ClaudeDo.Worker.Tests.Prime;
public class PrimeScheduleValidationTests
{
private static PrimeScheduleDto Dto(PrimeActionKind kind, string? prompt) =>
new(Guid.NewGuid(), 31, new TimeSpan(7, 0, 0), true, null, prompt, kind);
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void Custom_without_a_prompt_is_rejected(string? prompt)
{
var error = PrimeScheduleValidation.Validate(Dto(PrimeActionKind.Custom, prompt));
Assert.NotNull(error);
}
[Fact]
public void Custom_with_a_prompt_is_accepted()
{
Assert.Null(PrimeScheduleValidation.Validate(Dto(PrimeActionKind.Custom, "do the thing")));
}
[Fact]
public void Ping_without_a_prompt_is_accepted()
{
Assert.Null(PrimeScheduleValidation.Validate(Dto(PrimeActionKind.Ping, null)));
}
[Fact]
public void FillMyDay_without_a_prompt_is_accepted()
{
Assert.Null(PrimeScheduleValidation.Validate(Dto(PrimeActionKind.FillMyDay, null)));
}
}