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

Function TestAddSourceToWorkflow

pkg/cli/add_source_test.go:11–181  ·  view source on GitHub ↗

TestAddSourceToWorkflow tests the addSourceToWorkflow function

(t *testing.T)

Source from the content-addressed store, hash-verified

9
10// TestAddSourceToWorkflow tests the addSourceToWorkflow function
11func TestAddSourceToWorkflow(t *testing.T) {
12 tests := []struct {
13 name string
14 content string
15 source string
16 expectError bool
17 checkSource bool
18 }{
19 {
20 name: "add_source_to_workflow_with_frontmatter",
21 content: `---
22on: push
23permissions:
24 contents: read
25engine: claude
26---
27
28# Test Workflow
29
30This is a test workflow.`,
31 source: "githubnext/agentics/workflows/ci-doctor.md@v1.0.0",
32 expectError: false,
33 checkSource: true,
34 },
35 {
36 name: "add_source_to_workflow_without_frontmatter",
37 content: `# Test Workflow
38
39This is a test workflow without frontmatter.`,
40 source: "githubnext/agentics/workflows/test.md@main",
41 expectError: false,
42 checkSource: true,
43 },
44 {
45 name: "add_source_to_existing_workflow_with_fields",
46 content: `---
47description: "Test workflow description"
48on: push
49permissions:
50 contents: read
51engine: claude
52tools:
53 github:
54 allowed: [list_commits]
55---
56
57# Test Workflow
58
59This is a test workflow.`,
60 source: "githubnext/agentics/workflows/complex.md@v1.0.0",
61 expectError: false,
62 checkSource: true,
63 },
64 {
65 name: "verify_on_keyword_not_quoted",
66 content: `---
67on:
68 push:

Callers

nothing calls this directly

Calls 3

addSourceToWorkflowFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected