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

Function TestProcessIncludesWithWorkflowSpec_EmptyFilePath

pkg/cli/imports_test.go:117–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestProcessIncludesWithWorkflowSpec_EmptyFilePath(t *testing.T) {
118 // Test with section-only reference (should be skipped/passed through)
119 content := `---
120engine: claude
121---
122
123# Test Workflow
124
125{{#import? #SectionName}}
126
127More content.
128`
129
130 workflow := &WorkflowSpec{
131 RepoSpec: RepoSpec{
132 RepoSlug: "githubnext/agentics",
133 Version: "main",
134 },
135 }
136
137 result, err := processIncludesWithWorkflowSpec(content, workflow, "", "/tmp/package", "", false)
138 if err != nil {
139 t.Fatalf("Expected no error, got: %v", err)
140 }
141
142 // Should preserve the original line when filePath is empty
143 if !strings.Contains(result, "{{#import? #SectionName}}") {
144 t.Errorf("Expected result to preserve original line\nGot:\n%s", result)
145 }
146
147 // Should NOT generate malformed workflowspec
148 malformedPath := "githubnext/agentics/@"
149 if strings.Contains(result, malformedPath) {
150 t.Errorf("Result should NOT contain malformed path '%s'\nGot:\n%s", malformedPath, result)
151 }
152}
153
154func TestProcessIncludesInContent_NewSyntax(t *testing.T) {
155 // Test processIncludesInContent with new syntax

Callers

nothing calls this directly

Calls 2

ErrorfMethod · 0.45

Tested by

no test coverage detected