TestImportCycleError_InvalidChain tests handling of invalid cycle chains
(t *testing.T)
| 256 | |
| 257 | // TestImportCycleError_InvalidChain tests handling of invalid cycle chains |
| 258 | func TestImportCycleError_InvalidChain(t *testing.T) { |
| 259 | tests := []struct { |
| 260 | name string |
| 261 | chain []string |
| 262 | }{ |
| 263 | { |
| 264 | name: "empty chain", |
| 265 | chain: []string{}, |
| 266 | }, |
| 267 | { |
| 268 | name: "single element", |
| 269 | chain: []string{"a.md"}, |
| 270 | }, |
| 271 | } |
| 272 | |
| 273 | for _, tt := range tests { |
| 274 | t.Run(tt.name, func(t *testing.T) { |
| 275 | cycleErr := &parser.ImportCycleError{ |
| 276 | Chain: tt.chain, |
| 277 | WorkflowFile: "test.md", |
| 278 | } |
| 279 | |
| 280 | // Should still return an error, just not a detailed one |
| 281 | formatted := parser.FormatImportCycleError(cycleErr) |
| 282 | require.Error(t, formatted, "Should return error even for invalid chain") |
| 283 | |
| 284 | errMsg := formatted.Error() |
| 285 | assert.Contains(t, errMsg, "circular import", "Error should mention circular import") |
| 286 | }) |
| 287 | } |
| 288 | } |
nothing calls this directly
no test coverage detected