package system

import "testing"

func TestReportAddPreflightPassAndFail(t *testing.T) {
	report := Report{}

	pass := NewPreflight()
	report.AddPreflight("runtime bundle", pass, "ready")

	fail := NewPreflight()
	fail.Addf("missing firecracker")
	report.AddPreflight("core vm lifecycle", fail, "")

	if len(report.Checks) != 2 {
		t.Fatalf("len(report.Checks) = %d, want 2", len(report.Checks))
	}
	if report.Checks[0].Status != CheckStatusPass {
		t.Fatalf("report.Checks[0].Status = %s, want pass", report.Checks[0].Status)
	}
	if report.Checks[1].Status != CheckStatusFail {
		t.Fatalf("report.Checks[1].Status = %s, want fail", report.Checks[1].Status)
	}
	if !report.HasFailures() {
		t.Fatal("HasFailures() = false, want true")
	}
}
