package datacheck

import (
	"bytes"
	"context"
	"strings"
	"testing"
)

// TestRunPrintsStableSummary pins the stdout contract the smoke command exposes
// to operators: importing the embedded KIS fixture and querying bars back must
// always report one Samsung instrument with two daily bars spanning 2024-05-27
// to 2024-05-28, with no credential or external service.
func TestRunPrintsStableSummary(t *testing.T) {
	var buf bytes.Buffer
	if err := Run(context.Background(), &buf); err != nil {
		t.Fatalf("Run: %v", err)
	}

	got := buf.String()
	for _, want := range []string{
		"instrument_count=1",
		"bar_count=2",
		"first=2024-05-27",
		"last=2024-05-28",
	} {
		if !strings.Contains(got, want) {
			t.Errorf("summary %q missing %q", strings.TrimSpace(got), want)
		}
	}
}
