TestValidateWorkflowData tests the validateWorkflowData function
(t *testing.T)
| 530 | |
| 531 | // TestValidateWorkflowData tests the validateWorkflowData function |
| 532 | func TestValidateWorkflowData(t *testing.T) { |
| 533 | tests := []struct { |
| 534 | name string |
| 535 | workflowData *WorkflowData |
| 536 | strictMode bool |
| 537 | shouldError bool |
| 538 | errorContains string |
| 539 | }{ |
| 540 | { |
| 541 | name: "valid workflow", |
| 542 | workflowData: &WorkflowData{ |
| 543 | Name: "Valid Workflow", |
| 544 | Command: []string{"echo", "test"}, |
| 545 | MarkdownContent: "# Test", |
| 546 | AI: "copilot", |
| 547 | }, |
| 548 | strictMode: false, |
| 549 | shouldError: false, |
| 550 | }, |
| 551 | { |
| 552 | name: "invalid action-mode feature flag", |
| 553 | workflowData: &WorkflowData{ |
| 554 | Name: "Invalid Action Mode", |
| 555 | Command: []string{"echo", "test"}, |
| 556 | MarkdownContent: "# Test", |
| 557 | AI: "copilot", |
| 558 | Features: map[string]any{ |
| 559 | "action-mode": "invalid-mode", |
| 560 | }, |
| 561 | }, |
| 562 | strictMode: false, |
| 563 | shouldError: true, |
| 564 | errorContains: "invalid action-mode feature flag", |
| 565 | }, |
| 566 | { |
| 567 | name: "missing permissions for agentic-workflows tool", |
| 568 | workflowData: &WorkflowData{ |
| 569 | Name: "Missing Permissions", |
| 570 | Command: []string{"echo", "test"}, |
| 571 | MarkdownContent: "# Test", |
| 572 | AI: "copilot", |
| 573 | Tools: map[string]any{ |
| 574 | "agentic-workflows": map[string]any{}, |
| 575 | }, |
| 576 | Permissions: "", // No permissions |
| 577 | }, |
| 578 | strictMode: false, |
| 579 | shouldError: true, |
| 580 | errorContains: "Missing required permission for agentic-workflows tool", |
| 581 | }, |
| 582 | { |
| 583 | name: "workflow with empty markdown content", |
| 584 | workflowData: &WorkflowData{ |
| 585 | Name: "Empty Content", |
| 586 | Command: []string{"echo", "test"}, |
| 587 | MarkdownContent: "", |
| 588 | AI: "copilot", |
| 589 | }, |
nothing calls this directly
no test coverage detected