thread-master/apps/backend/internal/module/radar/usecase/priority_test.go

23 lines
808 B
Go
Raw Permalink Normal View History

2026-08-13 02:22:24 +00:00
package usecase
import (
"testing"
"apps/backend/internal/module/radar/domain"
)
func TestScoreOpportunityPriorityIncludesEvidenceAndFreshness(t *testing.T) {
got := scoreOpportunityPriority(&domain.CandidatePost{MatchedTerm: "泛紅", Text: "泛紅換季怎麼辦"}, &JudgeResult{
IntentScore: 80,
Reasons: []domain.OpportunityReason{
{Dimension: domain.DimIntent, Score: 30, Reason: "明確求助"},
{Dimension: domain.DimFreshness, Score: 15, Reason: "今天發布"},
{Dimension: domain.DimFit, Score: 10, Reason: "命中痛點"},
{Dimension: domain.DimAuthenticity, Score: 30, Reason: "真實語氣"},
},
})
if got.Priority < 50 || got.Band == "low" || got.DemandIntent != 100 || got.Freshness != 100 || len(got.Evidence) == 0 {
t.Fatalf("unexpected priority: %+v", got)
}
}