24 lines
1.1 KiB
Go
24 lines
1.1 KiB
Go
package growth
|
|
|
|
import "testing"
|
|
|
|
func TestRankEventPrefersMerchantFitAndHistoricalEvidence(t *testing.T) {
|
|
base := Event{ImportanceBPS: 8_000, ConfidenceBPS: 9_000, Categories: []string{"فروشگاه"}, Tags: []string{"وبسایت"}, LeadDays: 14, CommercialPosture: "PROMOTE"}
|
|
strong := RankEvent(base, RankInput{MerchantTerms: []string{"فروشگاه", "وبسایت"}, WithinPreparationWindow: true, HistoricalUpliftBPS: 12_000, HistoricalEligible: true})
|
|
weak := RankEvent(base, RankInput{MerchantTerms: []string{"نامرتبط"}})
|
|
if strong.ScoreBPS <= weak.ScoreBPS {
|
|
t.Fatalf("merchant fit and history must increase rank: strong=%d weak=%d", strong.ScoreBPS, weak.ScoreBPS)
|
|
}
|
|
if len(strong.Factors) < 3 {
|
|
t.Fatalf("rank factors = %+v, want actionable factors", strong.Factors)
|
|
}
|
|
}
|
|
|
|
func TestRankEventNeverPromotesMourningOrNoPromotionEvents(t *testing.T) {
|
|
for _, event := range []Event{{CommercialPosture: "NO_PROMOTION"}, {CommercialPosture: "PROMOTE", Tone: "MOURNING"}} {
|
|
if got := RankEvent(event, RankInput{WithinPreparationWindow: true}); got.Promotable {
|
|
t.Fatalf("event %+v is promotable", event)
|
|
}
|
|
}
|
|
}
|