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

Function TestBuildConditionTree

pkg/workflow/expressions_test.go:116–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestBuildConditionTree(t *testing.T) {
117 tests := []struct {
118 name string
119 existingCondition string
120 draftCondition string
121 expectedPattern string
122 }{
123 {
124 name: "empty existing condition",
125 existingCondition: "",
126 draftCondition: "draft_condition",
127 expectedPattern: "draft_condition",
128 },
129 {
130 name: "both conditions present",
131 existingCondition: "existing_condition",
132 draftCondition: "draft_condition",
133 expectedPattern: "(existing_condition) && (draft_condition)",
134 },
135 }
136
137 for _, tt := range tests {
138 t.Run(tt.name, func(t *testing.T) {
139 result := BuildConditionTree(tt.existingCondition, tt.draftCondition)
140 if rendered := result.Render(); rendered != tt.expectedPattern {
141 t.Errorf("Expected '%s', got '%s'", tt.expectedPattern, rendered)
142 }
143 })
144 }
145}
146
147func TestBuildReactionConditionForTargetsExcludesPullRequests(t *testing.T) {
148 result := BuildReactionConditionForTargets(true, false, true, false)

Callers

nothing calls this directly

Calls 4

BuildConditionTreeFunction · 0.85
RenderMethod · 0.65
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected