Resolved sub-tasks are no longer appended to the prompt. Extracted into a shared TaskPromptComposer so the UI's description preview can render the same 'what Claude gets' text. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using ClaudeDo.Data;
|
|
using Xunit;
|
|
|
|
namespace ClaudeDo.Data.Tests;
|
|
|
|
public class TaskPromptComposerTests
|
|
{
|
|
[Fact]
|
|
public void Composes_title_description_and_open_steps()
|
|
{
|
|
var result = TaskPromptComposer.Compose(
|
|
"Refactor diff viewer",
|
|
"Share the row template.",
|
|
new (string, bool)[] { ("Done step", true), ("Open step", false) });
|
|
|
|
Assert.Equal(
|
|
"Refactor diff viewer\n\nShare the row template.\n\n## Sub-Tasks\n- [ ] Open step\n",
|
|
result);
|
|
}
|
|
|
|
[Fact]
|
|
public void Drops_resolved_steps_and_omits_section_when_none_open()
|
|
{
|
|
var result = TaskPromptComposer.Compose(
|
|
"Title",
|
|
"Desc",
|
|
new (string, bool)[] { ("a", true), ("b", true) });
|
|
|
|
Assert.Equal("Title\n\nDesc", result);
|
|
}
|
|
|
|
[Fact]
|
|
public void Omits_description_when_blank()
|
|
{
|
|
var result = TaskPromptComposer.Compose("Title", " ", new (string, bool)[] { ("open", false) });
|
|
|
|
Assert.Equal("Title\n\n## Sub-Tasks\n- [ ] open\n", result);
|
|
}
|
|
|
|
[Fact]
|
|
public void Title_only_when_no_description_or_steps()
|
|
{
|
|
Assert.Equal("Just a title", TaskPromptComposer.Compose("Just a title", null, System.Array.Empty<(string, bool)>()));
|
|
}
|
|
}
|