TestValidator_DisplayStats tests statistics display
(t *testing.T)
| 407 | |
| 408 | // TestValidator_DisplayStats tests statistics display |
| 409 | func TestValidator_DisplayStats(t *testing.T) { |
| 410 | var buf bytes.Buffer |
| 411 | validator := NewValidator(&buf, &buf, ValidatorOptions{}) |
| 412 | |
| 413 | result := &output.ValidationResult{ |
| 414 | TotalFiles: 10, |
| 415 | ValidFiles: 8, |
| 416 | InvalidFiles: 2, |
| 417 | TotalBytes: 1024 * 1024, // 1 MB |
| 418 | Duration: 1000000000, // 1 second (in nanoseconds) |
| 419 | } |
| 420 | |
| 421 | validator.displayStats(result) |
| 422 | |
| 423 | output := buf.String() |
| 424 | expectedStrings := []string{ |
| 425 | "📊", |
| 426 | "Files processed: 10", |
| 427 | "Valid files: 8", |
| 428 | "Invalid files: 2", |
| 429 | "1.0 MB", |
| 430 | "10.0 files/sec", |
| 431 | } |
| 432 | |
| 433 | for _, expected := range expectedStrings { |
| 434 | if !strings.Contains(output, expected) { |
| 435 | t.Errorf("Expected output to contain '%s', got: %s", expected, output) |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | // TestValidator_NonExistentFile tests handling of non-existent files |
| 441 | func TestValidator_NonExistentFile(t *testing.T) { |
nothing calls this directly
no test coverage detected