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

Function TestReconstructContent

pkg/cli/yaml_frontmatter_utils_test.go:13–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestReconstructContent(t *testing.T) {
14 tests := []struct {
15 name string
16 frontmatterLines []string
17 markdown string
18 expectedInContent []string
19 }{
20 {
21 name: "basic reconstruction",
22 frontmatterLines: []string{
23 "on: workflow_dispatch",
24 "permissions:",
25 " contents: read",
26 },
27 markdown: "# Test\n\nContent",
28 expectedInContent: []string{
29 "---",
30 "on: workflow_dispatch",
31 "permissions:",
32 " contents: read",
33 "---",
34 "# Test",
35 },
36 },
37 {
38 name: "no markdown body",
39 frontmatterLines: []string{
40 "on: workflow_dispatch",
41 },
42 markdown: "",
43 expectedInContent: []string{
44 "---",
45 "on: workflow_dispatch",
46 "---",
47 },
48 },
49 }
50
51 for _, tt := range tests {
52 t.Run(tt.name, func(t *testing.T) {
53 result := reconstructContent(tt.frontmatterLines, tt.markdown)
54 for _, expected := range tt.expectedInContent {
55 assert.Contains(t, result, expected, "Expected content to contain %q", expected)
56 }
57 })
58 }
59}
60
61func TestParseFrontmatterLines(t *testing.T) {
62 tests := []struct {

Callers

nothing calls this directly

Calls 2

reconstructContentFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected