Skip to content

Commit 7109825

Browse files
yuukiclaude
andcommitted
test: merge jsonlines_test.go into printer_test.go
Consolidate JSON Lines tests into the main printer test file to reduce file fragmentation and improve test organization. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 39ebe8c commit 7109825

File tree

2 files changed

+9
-246
lines changed

2 files changed

+9
-246
lines changed

jsonlines_test.go

Lines changed: 0 additions & 242 deletions
This file was deleted.

printer_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func TestJSONLinesResult_AllFields(t *testing.T) {
503503
var buf bytes.Buffer
504504
printer := NewPrinter(&buf)
505505

506-
addr := "test.host:8080"
506+
addr := "localhost:8080"
507507
addrs := []string{addr}
508508

509509
// Set up timer with varied data for percentile calculations
@@ -534,9 +534,9 @@ func TestJSONLinesResult_AllFields(t *testing.T) {
534534
t.Fatalf("Failed to unmarshal JSON: %v", err)
535535
}
536536

537-
// Verify all fields are populated
538-
if result.Peer == "" {
539-
t.Error("Expected peer to be set")
537+
// Verify all fields are populated with expected values
538+
if result.Peer != addr {
539+
t.Errorf("Expected peer %s, got %s", addr, result.Peer)
540540
}
541541

542542
if result.Count != int64(len(testDurations)) {
@@ -575,6 +575,11 @@ func TestJSONLinesResult_AllFields(t *testing.T) {
575575
t.Error("Expected timestamp to be set")
576576
}
577577

578+
// Validate timestamp format
579+
if _, err := time.Parse(time.RFC3339, result.Timestamp); err != nil {
580+
t.Errorf("Expected valid RFC3339 timestamp, got %s", result.Timestamp)
581+
}
582+
578583
// Verify JSON field names
579584
var jsonMap map[string]interface{}
580585
if err := json.Unmarshal(buf.Bytes(), &jsonMap); err != nil {

0 commit comments

Comments
 (0)