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

Function TestReconstructWorkflowFile

pkg/parser/frontmatter_helpers_test.go:202–242  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

200}
201
202func TestReconstructWorkflowFile(t *testing.T) {
203 tests := []struct {
204 name string
205 frontmatterYAML string
206 markdownContent string
207 expectedResult string
208 }{
209 {
210 name: "With frontmatter and markdown",
211 frontmatterYAML: "engine: claude\ntools: {}",
212 markdownContent: "# Test Workflow\nSome content",
213 expectedResult: "---\nengine: claude\ntools: {}\n---\n# Test Workflow\nSome content",
214 },
215 {
216 name: "Empty frontmatter with markdown",
217 frontmatterYAML: "",
218 markdownContent: "# Test Workflow\nSome content",
219 expectedResult: "---\n---\n# Test Workflow\nSome content",
220 },
221 {
222 name: "Frontmatter with no markdown",
223 frontmatterYAML: "engine: claude",
224 markdownContent: "",
225 expectedResult: "---\nengine: claude\n---",
226 },
227 {
228 name: "Frontmatter with trailing newline",
229 frontmatterYAML: "engine: claude\n",
230 markdownContent: "# Test",
231 expectedResult: "---\nengine: claude\n---\n# Test",
232 },
233 }
234
235 for _, tt := range tests {
236 t.Run(tt.name, func(t *testing.T) {
237 result, err := ReconstructWorkflowFile(tt.frontmatterYAML, tt.markdownContent)
238 require.NoError(t, err, "ReconstructWorkflowFile should succeed")
239 assert.Equal(t, tt.expectedResult, result, "reconstructed file content should match")
240 })
241 }
242}

Callers

nothing calls this directly

Calls 2

ReconstructWorkflowFileFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected