fix: scope page insights to reporting periods
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
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,
|
||||
@@ -29,6 +30,7 @@ func TestDeterministicTransactionCopyDistinguishesPaymentStatesWithoutCausalClai
|
||||
func TestDeterministicTransactionCopyHandlesEmptyPeriod(t *testing.T) {
|
||||
copy := deterministicTransactionCopy(
|
||||
PeriodScope{JalaliLabelFA: "امروز"},
|
||||
"دیروز",
|
||||
aggregate{},
|
||||
aggregate{},
|
||||
false,
|
||||
@@ -43,3 +45,23 @@ func TestDeterministicTransactionCopyHandlesEmptyPeriod(t *testing.T) {
|
||||
t.Fatalf("expected unavailable rates in empty-period copy: %s", copy.LatestObserved.Body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeterministicPeriodCopyUsesSelectedPeriodForOverview(t *testing.T) {
|
||||
copy := deterministicPeriodCopy(
|
||||
ModuleOverview,
|
||||
PeriodScope{JalaliLabelFA: "مرداد ۱۴۰۵"},
|
||||
"تیر ۱۴۰۵",
|
||||
aggregate{Sessions: 10, Paid: 7},
|
||||
aggregate{Sessions: 8, Paid: 6},
|
||||
true,
|
||||
TimeContext{},
|
||||
ConfidenceHigh,
|
||||
)
|
||||
|
||||
if !strings.Contains(copy.LatestObserved.Body, "مرداد ۱۴۰۵") {
|
||||
t.Fatalf("selected period missing from summary: %s", copy.LatestObserved.Body)
|
||||
}
|
||||
if !strings.Contains(copy.Past.Body, "تیر ۱۴۰۵") {
|
||||
t.Fatalf("exact preceding period missing from comparison: %s", copy.Past.Body)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user