MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestValidator_DisplayStats

Function TestValidator_DisplayStats

cmd/gosqlx/cmd/validator_test.go:409–438  ·  view source on GitHub ↗

TestValidator_DisplayStats tests statistics display

(t *testing.T)

Source from the content-addressed store, hash-verified

407
408// TestValidator_DisplayStats tests statistics display
409func 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
441func TestValidator_NonExistentFile(t *testing.T) {

Callers

nothing calls this directly

Calls 4

displayStatsMethod · 0.95
NewValidatorFunction · 0.70
ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected