(t *testing.T)
| 289 | } |
| 290 | |
| 291 | func TestCopilotReplacer_ReplaceSlice(t *testing.T) { |
| 292 | type args struct { |
| 293 | handles []string |
| 294 | } |
| 295 | tests := []struct { |
| 296 | name string |
| 297 | returnLogin bool |
| 298 | args args |
| 299 | want []string |
| 300 | }{ |
| 301 | { |
| 302 | name: "replaces @copilot with login", |
| 303 | returnLogin: true, |
| 304 | args: args{ |
| 305 | handles: []string{"monalisa", "@copilot", "hubot"}, |
| 306 | }, |
| 307 | want: []string{"monalisa", "copilot-swe-agent", "hubot"}, |
| 308 | }, |
| 309 | { |
| 310 | name: "replaces @copilot with name", |
| 311 | args: args{ |
| 312 | handles: []string{"monalisa", "@copilot", "hubot"}, |
| 313 | }, |
| 314 | want: []string{"monalisa", "Copilot", "hubot"}, |
| 315 | }, |
| 316 | { |
| 317 | name: "handles no @copilot mentions", |
| 318 | args: args{ |
| 319 | handles: []string{"monalisa", "user", "hubot"}, |
| 320 | }, |
| 321 | want: []string{"monalisa", "user", "hubot"}, |
| 322 | }, |
| 323 | { |
| 324 | name: "replaces multiple @copilot mentions", |
| 325 | returnLogin: true, |
| 326 | args: args{ |
| 327 | handles: []string{"@copilot", "user", "@copilot"}, |
| 328 | }, |
| 329 | want: []string{"copilot-swe-agent", "user", "copilot-swe-agent"}, |
| 330 | }, |
| 331 | { |
| 332 | name: "handles @copilot case-insensitively", |
| 333 | returnLogin: true, |
| 334 | args: args{ |
| 335 | handles: []string{"@Copilot", "user", "@CoPiLoT"}, |
| 336 | }, |
| 337 | want: []string{"copilot-swe-agent", "user", "copilot-swe-agent"}, |
| 338 | }, |
| 339 | { |
| 340 | name: "handles nil slice", |
| 341 | args: args{ |
| 342 | handles: nil, |
| 343 | }, |
| 344 | want: []string{}, |
| 345 | }, |
| 346 | { |
| 347 | name: "handles empty slice", |
| 348 | args: args{ |
nothing calls this directly
no test coverage detected