TestImportMultipleTools tests importing multiple tools together
(t *testing.T)
| 184 | |
| 185 | // TestImportMultipleTools tests importing multiple tools together |
| 186 | func TestImportMultipleTools(t *testing.T) { |
| 187 | tempDir := testutil.TempDir(t, "test-*") |
| 188 | |
| 189 | // Create a shared workflow with multiple tools |
| 190 | sharedPath := filepath.Join(tempDir, "shared-all.md") |
| 191 | sharedContent := `--- |
| 192 | description: "Shared configuration with multiple tools" |
| 193 | tools: |
| 194 | agentic-workflows: true |
| 195 | playwright: |
| 196 | version: "v1.41.0" |
| 197 | permissions: |
| 198 | actions: read |
| 199 | network: |
| 200 | allowed: |
| 201 | - playwright |
| 202 | --- |
| 203 | |
| 204 | # Shared All Tools Configuration |
| 205 | ` |
| 206 | if err := os.WriteFile(sharedPath, []byte(sharedContent), 0644); err != nil { |
| 207 | t.Fatalf("Failed to write shared file: %v", err) |
| 208 | } |
| 209 | |
| 210 | // Create main workflow that imports all tools |
| 211 | workflowPath := filepath.Join(tempDir, "main-workflow.md") |
| 212 | workflowContent := `--- |
| 213 | on: issues |
| 214 | engine: copilot |
| 215 | imports: |
| 216 | - shared-all.md |
| 217 | permissions: |
| 218 | actions: read |
| 219 | contents: read |
| 220 | issues: read |
| 221 | pull-requests: read |
| 222 | --- |
| 223 | |
| 224 | # Main Workflow |
| 225 | |
| 226 | Uses all imported tools. |
| 227 | ` |
| 228 | if err := os.WriteFile(workflowPath, []byte(workflowContent), 0644); err != nil { |
| 229 | t.Fatalf("Failed to write workflow file: %v", err) |
| 230 | } |
| 231 | |
| 232 | // Compile the workflow |
| 233 | compiler := workflow.NewCompiler() |
| 234 | if err := compiler.CompileWorkflow(workflowPath); err != nil { |
| 235 | t.Fatalf("CompileWorkflow failed: %v", err) |
| 236 | } |
| 237 | |
| 238 | // Read the generated lock file |
| 239 | lockFilePath := stringutil.MarkdownToLockFile(workflowPath) |
| 240 | lockFileContent, err := os.ReadFile(lockFilePath) |
| 241 | if err != nil { |
| 242 | t.Fatalf("Failed to read lock file: %v", err) |
| 243 | } |
nothing calls this directly
no test coverage detected