package releasegate

import "testing"

func TestReportBlocksOnlyOnBlockingFindings(t *testing.T) {
	t.Parallel()

	report := Report{Phase: PhasePre, Findings: []Finding{{
		Code: "FOUNDATION_OBJECT_MISSING", Severity: SeverityInfo, Object: "tb_outbox_event",
	}}}
	if !report.Passed() {
		t.Fatal("迁移前公共对象尚未创建不应单独阻断发布")
	}
	report.Findings = append(report.Findings, Finding{
		Code: "OUTBOX_UNDELIVERED", Severity: SeverityBlock, Object: "tb_outbox_event", Count: 1,
	})
	if report.Passed() {
		t.Fatal("存在未投递事件时必须阻断发布")
	}
}
