style(go): apply gofmt to repository
Some checks failed
CI / verify (push) Failing after 24s

This commit is contained in:
Your Name
2026-05-06 12:22:41 +08:00
parent 43bcb499d0
commit 06eeb5776b
17 changed files with 132 additions and 133 deletions

View File

@@ -26,12 +26,12 @@ func TestDialogService_AC02_IntentMatrix(t *testing.T) {
svc := dialog.NewService(sessions, audits, tickets, dedup, intentservice.NewService(), reply.NewService(knowledge), handoff.NewService())
tests := []struct {
name string
content string
wantIntent string
wantHandoff bool
wantPriority string // empty if no handoff expected
wantReply bool // whether to check reply is non-empty
name string
content string
wantIntent string
wantHandoff bool
wantPriority string // empty if no handoff expected
wantReply bool // whether to check reply is non-empty
}{
{
name: "AC-02: 退款意图 → P1 handoff",
@@ -58,11 +58,11 @@ func TestDialogService_AC02_IntentMatrix(t *testing.T) {
wantReply: true,
},
{
name: "AC-02: 正常查询 → bot 回复无 handoff",
content: "查询额度",
wantIntent: "quota",
wantHandoff: false,
wantReply: true,
name: "AC-02: 正常查询 → bot 回复无 handoff",
content: "查询额度",
wantIntent: "quota",
wantHandoff: false,
wantReply: true,
},
}
@@ -70,9 +70,9 @@ func TestDialogService_AC02_IntentMatrix(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
result, err := svc.Process(context.Background(), &message.UnifiedMessage{
MessageID: "m_" + tc.name,
Channel: "widget",
OpenID: "u_" + tc.name,
Content: tc.content,
Channel: "widget",
OpenID: "u_" + tc.name,
Content: tc.content,
})
if err != nil {
t.Fatalf("Process() error = %v", err)

View File

@@ -41,27 +41,27 @@ func setupTicketStatsHandler(stats ticketstats.Stats) (*httptest.ResponseRecorde
// ticketStatsResponse mirrors the JSON shape of ticketstats.Stats.
type ticketStatsResponse struct {
Total int `json:"total_tickets"`
Open int `json:"open"`
Resolved int `json:"resolved"`
Closed int `json:"closed"`
ByChannel map[string]int `json:"by_channel"`
ByPriority map[string]int `json:"by_priority"`
HandoffCount int `json:"handoff_count"`
AvgResolutionTimeMinutes float64 `json:"avg_resolution_time_minutes"`
Total int `json:"total_tickets"`
Open int `json:"open"`
Resolved int `json:"resolved"`
Closed int `json:"closed"`
ByChannel map[string]int `json:"by_channel"`
ByPriority map[string]int `json:"by_priority"`
HandoffCount int `json:"handoff_count"`
AvgResolutionTimeMinutes float64 `json:"avg_resolution_time_minutes"`
}
// TestTicketStats_Success verifies the stats endpoint returns correct
// counts when the store has tickets.
func TestTicketStats_Success(t *testing.T) {
stats := ticketstats.Stats{
Total: 100,
Open: 30,
Resolved: 50,
Closed: 20,
ByChannel: map[string]int{"api": 40, "web": 60},
ByPriority: map[string]int{"P1": 10, "P2": 60, "P3": 30},
HandoffCount: 15,
Total: 100,
Open: 30,
Resolved: 50,
Closed: 20,
ByChannel: map[string]int{"api": 40, "web": 60},
ByPriority: map[string]int{"P1": 10, "P2": 60, "P3": 30},
HandoffCount: 15,
AvgResolutionTimeMinutes: 45.5,
}
@@ -114,13 +114,13 @@ func TestTicketStats_Success(t *testing.T) {
// TestTicketStats_Empty verifies that an empty store returns all-zero stats.
func TestTicketStats_Empty(t *testing.T) {
stats := ticketstats.Stats{
Total: 0,
Open: 0,
Resolved: 0,
Closed: 0,
ByChannel: map[string]int{},
ByPriority: map[string]int{},
HandoffCount: 0,
Total: 0,
Open: 0,
Resolved: 0,
Closed: 0,
ByChannel: map[string]int{},
ByPriority: map[string]int{},
HandoffCount: 0,
AvgResolutionTimeMinutes: 0,
}
@@ -163,14 +163,14 @@ func TestTicketStats_GroupedCounts(t *testing.T) {
Resolved: 10,
Closed: 5,
ByChannel: map[string]int{
"api": 8,
"web": 12,
"api": 8,
"web": 12,
"wechat": 5,
},
ByPriority: map[string]int{
"P1": 3,
"P1": 3,
"P2": 15,
"P3": 7,
"P3": 7,
},
HandoffCount: 6,
AvgResolutionTimeMinutes: 120.0,