()
| 12 | console.log(""); |
| 13 | |
| 14 | async function testWorkflowComponents() { |
| 15 | const taxonomy = new LabelTaxonomy(); |
| 16 | let allTestsPassed = true; |
| 17 | |
| 18 | // Test 1: Label Taxonomy |
| 19 | console.log("=== Test 1: Label Taxonomy ==="); |
| 20 | console.log(""); |
| 21 | try { |
| 22 | const allLabels = taxonomy.getAllLabels(); |
| 23 | console.log(`✅ Total labels in taxonomy: ${allLabels.length}`); |
| 24 | console.log(` - Feature/Component: ${taxonomy.feature_component.length}`); |
| 25 | console.log(` - OS-Specific: ${taxonomy.os_specific.length}`); |
| 26 | console.log(` - Theme: ${taxonomy.theme.length}`); |
| 27 | console.log(` - Workflow: ${taxonomy.workflow.length}`); |
| 28 | console.log(` - Special: ${taxonomy.special.length}`); |
| 29 | } catch (error) { |
| 30 | console.error("❌ Label taxonomy test failed:", error); |
| 31 | allTestsPassed = false; |
| 32 | } |
| 33 | console.log(""); |
| 34 | |
| 35 | // Test 2: Label Validation |
| 36 | console.log("=== Test 2: Label Validation ==="); |
| 37 | console.log(""); |
| 38 | try { |
| 39 | const testLabels = ["auth", "cli", "invalid-label", "os: mac"]; |
| 40 | const validLabels = validateLabels(testLabels, taxonomy); |
| 41 | console.log(`✅ Input labels: ${testLabels.join(", ")}`); |
| 42 | console.log(`✅ Valid labels: ${validLabels.join(", ")}`); |
| 43 | console.log(`✅ Filtered out: ${testLabels.filter(l => !validLabels.includes(l)).join(", ")}`); |
| 44 | } catch (error) { |
| 45 | console.error("❌ Label validation test failed:", error); |
| 46 | allTestsPassed = false; |
| 47 | } |
| 48 | console.log(""); |
| 49 | |
| 50 | // Test 3: AWS Bedrock Classification |
| 51 | console.log("=== Test 3: AWS Bedrock Classification ==="); |
| 52 | console.log(""); |
| 53 | |
| 54 | const testIssues = [ |
| 55 | { |
| 56 | title: "Terminal autocomplete broken", |
| 57 | body: "The autocomplete feature in the terminal doesn't work on Windows", |
| 58 | }, |
| 59 | { |
| 60 | title: "Slow IDE performance", |
| 61 | body: "The IDE is very slow when opening large files", |
| 62 | }, |
| 63 | ]; |
| 64 | |
| 65 | for (const issue of testIssues) { |
| 66 | try { |
| 67 | console.log(`Testing: "${issue.title}"`); |
| 68 | const result = await classifyIssue(issue.title, issue.body, taxonomy); |
| 69 | |
| 70 | if (result.error) { |
| 71 | console.error(`❌ Classification failed: ${result.error}`); |
no test coverage detected