70 lines
1.9 KiB
Go
70 lines
1.9 KiB
Go
// Package coverage defines the domain logic for coverage evaluation.
|
|
package coverage
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea.zheromiku.top/Weknora/dobotai-platform/internal/core"
|
|
)
|
|
|
|
func TestSupportNotificationFields(t *testing.T) {
|
|
// Verify that SupportNotification is a plain data struct with only the
|
|
// safe fields listed in the spec. Token, webhook, raw IDs, raw responses,
|
|
// and reference bodies must NOT be present.
|
|
notif := SupportNotification{
|
|
CaseID: "case-001",
|
|
Question: "怎么配置钉钉机器人?",
|
|
Answer: "进入钉钉开放平台...",
|
|
SenderName: "张三",
|
|
Channel: "dingtalk",
|
|
ConversationType: core.ConversationGroup,
|
|
ReferenceCount: 3,
|
|
TopScore: 0.95,
|
|
}
|
|
|
|
if notif.CaseID != "case-001" {
|
|
t.Fatalf("CaseID = %q, want case-001", notif.CaseID)
|
|
}
|
|
if notif.Question != "怎么配置钉钉机器人?" {
|
|
t.Fatalf("Question = %q", notif.Question)
|
|
}
|
|
if notif.Answer != "进入钉钉开放平台..." {
|
|
t.Fatalf("Answer = %q", notif.Answer)
|
|
}
|
|
if notif.SenderName != "张三" {
|
|
t.Fatalf("SenderName = %q", notif.SenderName)
|
|
}
|
|
if notif.Channel != "dingtalk" {
|
|
t.Fatalf("Channel = %q", notif.Channel)
|
|
}
|
|
if notif.ConversationType != core.ConversationGroup {
|
|
t.Fatalf("ConversationType = %q", notif.ConversationType)
|
|
}
|
|
if notif.ReferenceCount != 3 {
|
|
t.Fatalf("ReferenceCount = %d", notif.ReferenceCount)
|
|
}
|
|
if notif.TopScore != 0.95 {
|
|
t.Fatalf("TopScore = %f", notif.TopScore)
|
|
}
|
|
}
|
|
|
|
func TestSupportNotificationEmptyValues(t *testing.T) {
|
|
// Zero-value notification should be safe to render (no panic).
|
|
notif := SupportNotification{}
|
|
if notif.CaseID != "" {
|
|
t.Fatalf("expected empty CaseID")
|
|
}
|
|
if notif.Question != "" {
|
|
t.Fatalf("expected empty Question")
|
|
}
|
|
if notif.Answer != "" {
|
|
t.Fatalf("expected empty Answer")
|
|
}
|
|
if notif.ReferenceCount != 0 {
|
|
t.Fatalf("expected zero ReferenceCount")
|
|
}
|
|
if notif.TopScore != 0 {
|
|
t.Fatalf("expected zero TopScore")
|
|
}
|
|
}
|