MCPcopy Create free account
hub / github.com/github/gh-aw / TestRenderJSONComplete

Function TestRenderJSONComplete

pkg/cli/audit_report_test.go:902–991  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

900}
901
902func TestRenderJSONComplete(t *testing.T) {
903 auditData := AuditData{
904 Overview: OverviewData{
905 RunID: 99999,
906 WorkflowName: "JSON Test",
907 Status: "completed",
908 Conclusion: "success",
909 Event: "push",
910 Branch: "main",
911 URL: "https://github.com/test/repo/actions/runs/99999",
912 },
913 Metrics: MetricsData{
914 TokenUsage: 5000,
915 Turns: 4,
916 ErrorCount: 1,
917 WarningCount: 2,
918 },
919 KeyFindings: []Finding{
920 {Category: "success", Severity: "info", Title: "Test Finding", Description: "Test description"},
921 },
922 Recommendations: []Recommendation{
923 {Priority: "low", Action: "Monitor", Reason: "Test reason"},
924 },
925 Jobs: []JobData{
926 {
927 Name: "test-job",
928 Status: "completed",
929 Conclusion: "success",
930 Duration: "1m30s",
931 Steps: []JobStepData{
932 {Name: "Set up job", Status: "completed", Conclusion: "success"},
933 {Name: "Run agent", Status: "completed", Conclusion: "success"},
934 },
935 },
936 },
937 DownloadedFiles: []FileInfo{
938 {Path: "test.log", Size: 1024, Description: "Test log"},
939 },
940 Errors: []ErrorInfo{
941 {Type: "error", Message: "Test error"},
942 },
943 Warnings: []ErrorInfo{
944 {Type: "warning", Message: "Test warning 1"},
945 {Type: "warning", Message: "Test warning 2"},
946 },
947 ToolUsage: []ToolUsageInfo{
948 {Name: "bash", CallCount: 5, MaxInputSize: 100, MaxOutputSize: 500},
949 },
950 }
951
952 // Capture stdout
953 oldStdout := os.Stdout
954 r, w, _ := os.Pipe()
955 os.Stdout = w
956
957 err := renderJSON(auditData)
958 w.Close()
959

Callers

nothing calls this directly

Calls 3

renderJSONFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected