======================================== NormalizeSafeOutputIdentifier Tests ======================================== TestNormalizeSafeOutputIdentifier tests the normalizeSafeOutputIdentifier function
(t *testing.T)
| 222 | |
| 223 | // TestNormalizeSafeOutputIdentifier tests the normalizeSafeOutputIdentifier function |
| 224 | func TestNormalizeSafeOutputIdentifier(t *testing.T) { |
| 225 | tests := []struct { |
| 226 | name string |
| 227 | identifier string |
| 228 | expected string |
| 229 | }{ |
| 230 | { |
| 231 | name: "dash to underscore conversion", |
| 232 | identifier: "create-issue", |
| 233 | expected: "create_issue", |
| 234 | }, |
| 235 | { |
| 236 | name: "already underscore format", |
| 237 | identifier: "create_issue", |
| 238 | expected: "create_issue", |
| 239 | }, |
| 240 | { |
| 241 | name: "multiple dashes", |
| 242 | identifier: "create-pull-request-review-comment", |
| 243 | expected: "create_pull_request_review_comment", |
| 244 | }, |
| 245 | { |
| 246 | name: "no dashes or underscores", |
| 247 | identifier: "noop", |
| 248 | expected: "noop", |
| 249 | }, |
| 250 | { |
| 251 | name: "empty string", |
| 252 | identifier: "", |
| 253 | expected: "", |
| 254 | }, |
| 255 | { |
| 256 | name: "add-comment", |
| 257 | identifier: "add-comment", |
| 258 | expected: "add_comment", |
| 259 | }, |
| 260 | { |
| 261 | name: "link-sub-issue", |
| 262 | identifier: "link-sub-issue", |
| 263 | expected: "link_sub_issue", |
| 264 | }, |
| 265 | } |
| 266 | |
| 267 | for _, tt := range tests { |
| 268 | t.Run(tt.name, func(t *testing.T) { |
| 269 | result := stringutil.NormalizeSafeOutputIdentifier(tt.identifier) |
| 270 | if result != tt.expected { |
| 271 | t.Errorf("stringutil.NormalizeSafeOutputIdentifier(%q) = %q, want %q", tt.identifier, result, tt.expected) |
| 272 | } |
| 273 | }) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | // ======================================== |
| 278 | // ParseMessagesConfig Tests |
nothing calls this directly
no test coverage detected