23 lines
808 B
Go
23 lines
808 B
Go
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)
|
|
}
|
|
}
|