(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func 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 | |
| 147 | func TestBuildReactionConditionForTargetsExcludesPullRequests(t *testing.T) { |
| 148 | result := BuildReactionConditionForTargets(true, false, true, false) |
nothing calls this directly
no test coverage detected