(t *testing.T)
| 492 | } |
| 493 | |
| 494 | func TestChatGPTFetch_ObjectIDParsing(t *testing.T) { |
| 495 | t.Parallel() |
| 496 | |
| 497 | tests := []struct { |
| 498 | name string |
| 499 | objectID string |
| 500 | expectError bool |
| 501 | errorMsg string |
| 502 | }{ |
| 503 | { |
| 504 | name: "ValidTemplateID", |
| 505 | objectID: "template:" + uuid.NewString(), |
| 506 | expectError: false, |
| 507 | }, |
| 508 | { |
| 509 | name: "ValidWorkspaceID", |
| 510 | objectID: "workspace:" + uuid.NewString(), |
| 511 | expectError: false, |
| 512 | }, |
| 513 | { |
| 514 | name: "MissingColon", |
| 515 | objectID: "template" + uuid.NewString(), |
| 516 | expectError: true, |
| 517 | errorMsg: "invalid ID", |
| 518 | }, |
| 519 | { |
| 520 | name: "InvalidUUID", |
| 521 | objectID: "template:invalid-uuid", |
| 522 | expectError: true, |
| 523 | errorMsg: "invalid template ID, must be a valid UUID", |
| 524 | }, |
| 525 | { |
| 526 | name: "UnsupportedType", |
| 527 | objectID: "user:" + uuid.NewString(), |
| 528 | expectError: true, |
| 529 | errorMsg: "invalid ID", |
| 530 | }, |
| 531 | { |
| 532 | name: "EmptyID", |
| 533 | objectID: "", |
| 534 | expectError: true, |
| 535 | errorMsg: "invalid ID", |
| 536 | }, |
| 537 | } |
| 538 | |
| 539 | for _, tt := range tests { |
| 540 | t.Run(tt.name, func(t *testing.T) { |
| 541 | t.Parallel() |
| 542 | |
| 543 | // Setup minimal environment |
| 544 | client, _ := coderdtest.NewWithDatabase(t, nil) |
| 545 | coderdtest.CreateFirstUser(t, client) |
| 546 | |
| 547 | deps, err := toolsdk.NewDeps(client) |
| 548 | require.NoError(t, err) |
| 549 | |
| 550 | // Execute tool |
| 551 | args := toolsdk.FetchArgs{ID: tt.objectID} |
nothing calls this directly
no test coverage detected