feat: add persisted page insight platform
This commit is contained in:
28
internal/eventcatalog/import_test.go
Normal file
28
internal/eventcatalog/import_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package eventcatalog
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateImportRequiresThreePastAndTwoFutureJalaliYears(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
input := Import{Version: "1402-1407-v1", CoverageStartJalaliYear: 1402, CoverageEndJalaliYear: 1407, SourceURI: "https://calendar.ut.ac.ir/", SourceVersion: "reviewed", SourceChecksum: "abc", ImportedBy: "operator-a", Events: []Event{{ID: "nowruz", TitleFA: "نوروز", StartDate: "2026-03-21", EndDate: "2026-03-24", Type: TypeCultural, Tone: ToneCelebratory, CommercialPosture: PosturePromote, SourceURI: "https://calendar.ut.ac.ir/", SourceVersion: "1405", InclusionRationale: "تقویم رسمی", GeographicScope: "IR", RelevanceBPS: 10000, ConfidenceBPS: 10000}}}
|
||||
if err := ValidateImport(input, 1405); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
input.CoverageStartJalaliYear = 1403
|
||||
if err := ValidateImport(input, 1405); err == nil {
|
||||
t.Fatal("expected insufficient past coverage")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateApprovalRequiresIndependentReviewer(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if err := ValidateApproval("operator-a", "operator-a"); err == nil {
|
||||
t.Fatal("expected independent reviewer error")
|
||||
}
|
||||
if err := ValidateApproval("operator-a", "operator-b"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user