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

Function TestExtractWorkflowNameFromPath

pkg/cli/commands_utils_test.go:148–194  ·  view source on GitHub ↗

TestFindGitRoot is already tested in gitroot_test.go, skipping duplicate

(t *testing.T)

Source from the content-addressed store, hash-verified

146// TestFindGitRoot is already tested in gitroot_test.go, skipping duplicate
147
148func TestExtractWorkflowNameFromPath(t *testing.T) {
149 tests := []struct {
150 name string
151 path string
152 expected string
153 }{
154 {
155 name: "simple workflow file",
156 path: ".github/workflows/daily-test.lock.yml",
157 expected: "daily-test",
158 },
159 {
160 name: "workflow file without lock suffix",
161 path: ".github/workflows/weekly-research.yml",
162 expected: "weekly-research",
163 },
164 {
165 name: "nested path",
166 path: "/home/user/project/.github/workflows/complex-workflow-name.lock.yml",
167 expected: "complex-workflow-name",
168 },
169 {
170 name: "file without extension",
171 path: ".github/workflows/workflow",
172 expected: "workflow",
173 },
174 {
175 name: "single file name",
176 path: "test.yml",
177 expected: "test",
178 },
179 {
180 name: "file with multiple dots",
181 path: "test.lock.yml",
182 expected: "test",
183 },
184 }
185
186 for _, tt := range tests {
187 t.Run(tt.name, func(t *testing.T) {
188 result := extractWorkflowNameFromPath(tt.path)
189 if result != tt.expected {
190 t.Errorf("Expected %q, got %q", tt.expected, result)
191 }
192 })
193 }
194}
195
196func TestFindIncludesInContent(t *testing.T) {
197 tests := []struct {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected