Skip to content

Commit 188e956

Browse files
Copilotpelikhan
andauthored
test: add ToMap round-trip test for expression and float rejection for timeout-minutes
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f80cd78a-1d25-4f2b-8c69-166d9dc00adb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 5f754b2 commit 188e956

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

pkg/workflow/frontmatter_types_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ func TestParseFrontmatterConfig(t *testing.T) {
158158
}
159159
})
160160

161+
t.Run("rejects timeout-minutes as float", func(t *testing.T) {
162+
frontmatter := map[string]any{
163+
"timeout-minutes": 5.5,
164+
}
165+
166+
_, err := ParseFrontmatterConfig(frontmatter)
167+
if err == nil {
168+
t.Error("expected error for float timeout-minutes, got nil")
169+
}
170+
})
171+
161172
t.Run("rejects timeout-minutes as free-form string", func(t *testing.T) {
162173
frontmatter := map[string]any{
163174
"timeout-minutes": "not-an-expression",
@@ -494,6 +505,25 @@ func TestFrontmatterConfigBackwardCompatibility(t *testing.T) {
494505
}
495506
})
496507

508+
t.Run("round-trip preserves timeout-minutes expression", func(t *testing.T) {
509+
frontmatter := map[string]any{
510+
"name": "test-workflow",
511+
"engine": "copilot",
512+
"timeout-minutes": "${{ inputs.timeout }}",
513+
}
514+
515+
config, err := ParseFrontmatterConfig(frontmatter)
516+
if err != nil {
517+
t.Fatalf("parse error: %v", err)
518+
}
519+
520+
reconstructed := config.ToMap()
521+
522+
if reconstructed["timeout-minutes"] != "${{ inputs.timeout }}" {
523+
t.Errorf("timeout-minutes expression mismatch: got %v (%T)", reconstructed["timeout-minutes"], reconstructed["timeout-minutes"])
524+
}
525+
})
526+
497527
t.Run("round-trip preserves labels", func(t *testing.T) {
498528
frontmatter := map[string]any{
499529
"name": "test-workflow",

0 commit comments

Comments
 (0)