MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_ValidateWorkflowIntent

Function TestSpec_PublicAPI_ValidateWorkflowIntent

pkg/cli/spec_test.go:308–351  ·  view source on GitHub ↗

TestSpec_PublicAPI_ValidateWorkflowIntent validates the documented validation rules. Spec: "Validates the workflow intent string"

(t *testing.T)

Source from the content-addressed store, hash-verified

306// TestSpec_PublicAPI_ValidateWorkflowIntent validates the documented validation rules.
307// Spec: "Validates the workflow intent string"
308func TestSpec_PublicAPI_ValidateWorkflowIntent(t *testing.T) {
309 tests := []struct {
310 name string
311 input string
312 wantErr bool
313 }{
314 {
315 name: "empty string returns error",
316 input: "",
317 wantErr: true,
318 },
319 {
320 name: "whitespace-only string returns error",
321 input: " ",
322 wantErr: true,
323 },
324 {
325 name: "string shorter than 20 characters returns error",
326 input: "too short",
327 wantErr: true,
328 },
329 {
330 name: "string of exactly 20 characters is valid",
331 input: "twelve chars here!!!",
332 wantErr: false,
333 },
334 {
335 name: "string longer than 20 characters is valid",
336 input: "This is a sufficiently long workflow intent description",
337 wantErr: false,
338 },
339 }
340
341 for _, tt := range tests {
342 t.Run(tt.name, func(t *testing.T) {
343 err := cli.ValidateWorkflowIntent(tt.input)
344 if tt.wantErr {
345 assert.Error(t, err, "ValidateWorkflowIntent(%q) should return error", tt.input)
346 } else {
347 assert.NoError(t, err, "ValidateWorkflowIntent(%q) should not return error", tt.input)
348 }
349 })
350 }
351}
352
353// TestSpec_PublicAPI_UpdateFieldInFrontmatter validates the documented frontmatter field update.
354// Spec: "Sets a field in frontmatter YAML"

Callers

nothing calls this directly

Calls 3

ValidateWorkflowIntentFunction · 0.92
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected