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

Function TestSpec_PublicAPI_ExtractWorkflowDescription

pkg/cli/spec_test.go:150–179  ·  view source on GitHub ↗

TestSpec_PublicAPI_ExtractWorkflowDescription validates extraction of the description field. Spec: "Extracts the description field from workflow markdown content"

(t *testing.T)

Source from the content-addressed store, hash-verified

148// TestSpec_PublicAPI_ExtractWorkflowDescription validates extraction of the description field.
149// Spec: "Extracts the description field from workflow markdown content"
150func TestSpec_PublicAPI_ExtractWorkflowDescription(t *testing.T) {
151 tests := []struct {
152 name string
153 content string
154 expected string
155 }{
156 {
157 name: "extracts description from frontmatter",
158 content: "---\ndescription: My workflow description\n---\n\n# Content",
159 expected: "My workflow description",
160 },
161 {
162 name: "returns empty string when no description field",
163 content: "---\nengine: copilot\n---\n\n# Content",
164 expected: "",
165 },
166 {
167 name: "returns empty string for content without frontmatter",
168 content: "# Just markdown",
169 expected: "",
170 },
171 }
172
173 for _, tt := range tests {
174 t.Run(tt.name, func(t *testing.T) {
175 result := cli.ExtractWorkflowDescription(tt.content)
176 assert.Equal(t, tt.expected, result, "ExtractWorkflowDescription mismatch for %q", tt.name)
177 })
178 }
179}
180
181// TestSpec_PublicAPI_ExtractWorkflowEngine validates extraction of the engine field.
182// Spec: "Extracts the engine field from workflow markdown content"

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected