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

Function TestBuildLogsDataWithoutContinuation

pkg/cli/logs_json_test.go:723–759  ·  view source on GitHub ↗

TestBuildLogsDataWithoutContinuation tests that continuation is omitted when nil

(t *testing.T)

Source from the content-addressed store, hash-verified

721
722// TestBuildLogsDataWithoutContinuation tests that continuation is omitted when nil
723func TestBuildLogsDataWithoutContinuation(t *testing.T) {
724 tmpDir := testutil.TempDir(t, "test-*")
725
726 processedRuns := []ProcessedRun{
727 {
728 Run: WorkflowRun{
729 DatabaseID: 12345,
730 WorkflowName: "Test Workflow",
731 LogsPath: filepath.Join(tmpDir, "run-12345"),
732 },
733 },
734 }
735
736 // Build logs data without continuation
737 logsData := buildLogsData(processedRuns, tmpDir, nil)
738
739 // Verify continuation field is nil
740 if logsData.Continuation != nil {
741 t.Errorf("Expected continuation field to be nil, got %+v", logsData.Continuation)
742 }
743
744 // Test JSON serialization
745 jsonOutput, err := json.Marshal(logsData)
746 if err != nil {
747 t.Fatalf("Failed to marshal logs data to JSON: %v", err)
748 }
749
750 // Verify continuation is omitted from JSON (due to omitempty tag)
751 var parsedMap map[string]any
752 if err := json.Unmarshal(jsonOutput, &parsedMap); err != nil {
753 t.Fatalf("Failed to unmarshal logs data to map: %v", err)
754 }
755
756 if _, exists := parsedMap["continuation"]; exists {
757 t.Error("Expected continuation field to be omitted from JSON when nil")
758 }
759}
760
761// TestBuildMCPFailuresSummary tests MCP failures aggregation
762func TestBuildMCPFailuresSummary(t *testing.T) {

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
buildLogsDataFunction · 0.85
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected