Extend coach proposal with allowed window classes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 16:49:06 -04:00
parent 83bae00e45
commit 75d31b5fa8
3 changed files with 42 additions and 8 deletions
+20
View File
@@ -69,3 +69,23 @@ func TestParseProposal(t *testing.T) {
}
}
}
func TestParseProposalReadsAllowedClasses(t *testing.T) {
p, err := parseProposal(`{"next_action":"a","success_condition":"b","timebox_minutes":20,"allowed_window_classes":["code"," firefox ",""]}`)
if err != nil {
t.Fatalf("parse: %v", err)
}
if len(p.AllowedWindowClasses) != 2 || p.AllowedWindowClasses[0] != "code" || p.AllowedWindowClasses[1] != "firefox" {
t.Fatalf("classes wrong (blanks should drop, trim applied): %#v", p.AllowedWindowClasses)
}
}
func TestParseProposalAllowedClassesOptional(t *testing.T) {
p, err := parseProposal(`{"next_action":"a","success_condition":"b","timebox_minutes":20}`)
if err != nil {
t.Fatalf("parse: %v", err)
}
if len(p.AllowedWindowClasses) != 0 {
t.Fatalf("absent field should yield empty slice, got %#v", p.AllowedWindowClasses)
}
}