(t *testing.T)
| 155 | } |
| 156 | |
| 157 | func TestValidateFeatures(t *testing.T) { |
| 158 | tests := []struct { |
| 159 | name string |
| 160 | data *WorkflowData |
| 161 | expectError bool |
| 162 | errorMsg string |
| 163 | }{ |
| 164 | { |
| 165 | name: "nil data", |
| 166 | data: nil, |
| 167 | expectError: false, |
| 168 | }, |
| 169 | { |
| 170 | name: "nil features", |
| 171 | data: &WorkflowData{Features: nil}, |
| 172 | expectError: false, |
| 173 | }, |
| 174 | { |
| 175 | name: "valid action-tag", |
| 176 | data: &WorkflowData{ |
| 177 | Features: map[string]any{ |
| 178 | "action-tag": "2d4c6ce24c55704d72ec674d1f5c357831435180", |
| 179 | }, |
| 180 | }, |
| 181 | expectError: false, |
| 182 | }, |
| 183 | { |
| 184 | name: "invalid action-tag - short SHA", |
| 185 | data: &WorkflowData{ |
| 186 | Features: map[string]any{ |
| 187 | "action-tag": "5c3428a", |
| 188 | }, |
| 189 | }, |
| 190 | expectError: true, |
| 191 | errorMsg: "action-tag must be a full 40-character commit SHA or a version tag", |
| 192 | }, |
| 193 | { |
| 194 | name: "valid action-tag - version tag", |
| 195 | data: &WorkflowData{ |
| 196 | Features: map[string]any{ |
| 197 | "action-tag": "v2.0.0", |
| 198 | }, |
| 199 | }, |
| 200 | expectError: false, |
| 201 | }, |
| 202 | { |
| 203 | name: "empty action-tag is allowed", |
| 204 | data: &WorkflowData{ |
| 205 | Features: map[string]any{ |
| 206 | "action-tag": "", |
| 207 | }, |
| 208 | }, |
| 209 | expectError: false, |
| 210 | }, |
| 211 | { |
| 212 | name: "other features should not cause errors", |
| 213 | data: &WorkflowData{ |
| 214 | Features: map[string]any{ |
nothing calls this directly
no test coverage detected