(t *testing.T)
| 364 | } |
| 365 | |
| 366 | func TestValidateWorkflowIntent_EdgeCases(t *testing.T) { |
| 367 | tests := []struct { |
| 368 | name string |
| 369 | input string |
| 370 | expectError bool |
| 371 | }{ |
| 372 | { |
| 373 | name: "exactly 20 characters with spaces", |
| 374 | input: "a b c d e f g h i j k", |
| 375 | expectError: false, |
| 376 | }, |
| 377 | { |
| 378 | name: "unicode characters", |
| 379 | input: "Create workflow with émojis 🎉🎊", |
| 380 | expectError: false, |
| 381 | }, |
| 382 | { |
| 383 | name: "special characters", |
| 384 | input: "Create workflow: @user, #123, $var!", |
| 385 | expectError: false, |
| 386 | }, |
| 387 | { |
| 388 | name: "very long intent", |
| 389 | input: strings.Repeat("a", 1000), |
| 390 | expectError: false, |
| 391 | }, |
| 392 | { |
| 393 | name: "mixed whitespace", |
| 394 | input: " \t\n Create workflow for automation \t\n ", |
| 395 | expectError: false, |
| 396 | }, |
| 397 | { |
| 398 | name: "only punctuation but >= 20 chars", |
| 399 | input: "!@#$%^&*()_+-={}[]|;", |
| 400 | expectError: false, |
| 401 | }, |
| 402 | } |
| 403 | |
| 404 | for _, tt := range tests { |
| 405 | t.Run(tt.name, func(t *testing.T) { |
| 406 | err := ValidateWorkflowIntent(tt.input) |
| 407 | |
| 408 | if tt.expectError && err == nil { |
| 409 | t.Errorf("ValidateWorkflowIntent(%q) expected error but got nil", tt.input) |
| 410 | } |
| 411 | if !tt.expectError && err != nil { |
| 412 | t.Errorf("ValidateWorkflowIntent(%q) unexpected error: %v", tt.input, err) |
| 413 | } |
| 414 | }) |
| 415 | } |
| 416 | } |
nothing calls this directly
no test coverage detected