TestMissingToolSummaryDisplayFields verifies that Display fields are used by console rendering
(t *testing.T)
| 11 | |
| 12 | // TestMissingToolSummaryDisplayFields verifies that Display fields are used by console rendering |
| 13 | func TestMissingToolSummaryDisplayFields(t *testing.T) { |
| 14 | // Create a MissingToolSummary with populated Display fields |
| 15 | summaries := []MissingToolSummary{ |
| 16 | { |
| 17 | Tool: "test-tool", |
| 18 | AggregatedSummaryBase: AggregatedSummaryBase{ |
| 19 | Count: 5, |
| 20 | Workflows: []string{"workflow1", "workflow2", "workflow3"}, |
| 21 | WorkflowsDisplay: "workflow1, workflow2, workflow3", // This should be rendered |
| 22 | FirstReason: "Tool not found in MCP server", |
| 23 | FirstReasonDisplay: "Tool not found in MCP server", // This should be rendered |
| 24 | RunIDs: []int64{1, 2, 3}, |
| 25 | }, |
| 26 | }, |
| 27 | } |
| 28 | |
| 29 | // Render using console.RenderStruct |
| 30 | output := console.RenderStruct(summaries) |
| 31 | |
| 32 | // Verify that Display fields are included in output |
| 33 | if !strings.Contains(output, "workflow1, workflow2, workflow3") { |
| 34 | t.Errorf("WorkflowsDisplay field not found in console output:\n%s", output) |
| 35 | } |
| 36 | |
| 37 | if !strings.Contains(output, "Tool not found in MCP server") { |
| 38 | t.Errorf("FirstReasonDisplay field not found in console output:\n%s", output) |
| 39 | } |
| 40 | |
| 41 | // Verify headers are present |
| 42 | if !strings.Contains(output, "Tool") { |
| 43 | t.Errorf("Tool header not found in console output") |
| 44 | } |
| 45 | if !strings.Contains(output, "Occurrences") { |
| 46 | t.Errorf("Occurrences header not found in console output") |
| 47 | } |
| 48 | if !strings.Contains(output, "Workflows") { |
| 49 | t.Errorf("Workflows header not found in console output") |
| 50 | } |
| 51 | if !strings.Contains(output, "First Reason") { |
| 52 | t.Errorf("First Reason header not found in console output") |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // TestMCPFailureSummaryDisplayFields verifies that Display fields are used by console rendering |
| 57 | func TestMCPFailureSummaryDisplayFields(t *testing.T) { |
nothing calls this directly
no test coverage detected