package insight import ( "strings" "testing" ) func TestDeterministicTransactionCopyDistinguishesPaymentStatesWithoutCausalClaims(t *testing.T) { copy := deterministicTransactionCopy( PeriodScope{JalaliLabelFA: "مرداد ۱۴۰۵"}, aggregate{Sessions: 10, Paid: 7, Verified: 5, Unverified: 2, Failed: 2, Reversed: 1}, aggregate{Sessions: 8, Paid: 6}, true, TimeContext{}, ConfidenceHigh, ) body := copy.LatestObserved.Body for _, expected := range []string{"پرداخت‌شده و در انتظار تأیید", "تأیید نهایی", "ناموفق"} { if !strings.Contains(body, expected) { t.Fatalf("expected transaction copy to contain %q: %s", expected, body) } } if !strings.Contains(copy.Past.Body, "علت آن را مشخص نمی‌کند") { t.Fatalf("expected non-causal comparison language: %s", copy.Past.Body) } } func TestDeterministicTransactionCopyHandlesEmptyPeriod(t *testing.T) { copy := deterministicTransactionCopy( PeriodScope{JalaliLabelFA: "امروز"}, aggregate{}, aggregate{}, false, TimeContext{}, ConfidenceInsufficientData, ) if strings.Contains(copy.LatestObserved.Body, "") { t.Fatalf("empty-period copy exposed an implementation value: %s", copy.LatestObserved.Body) } if !strings.Contains(copy.LatestObserved.Body, "ناموجود") { t.Fatalf("expected unavailable rates in empty-period copy: %s", copy.LatestObserved.Body) } }