package bridge import ( "testing" "time" ) func TestUnifiedMessage(t *testing.T) { msg := &UnifiedMessage{ ID: "123", Platform: "qq", Source: "group-456", SenderID: "789", SenderName: "测试用户", Content: "你好", IsAtBot: true, Timestamp: time.Now(), } if msg.Platform != "qq" { t.Error("expected qq") } if !msg.IsAtBot { t.Error("expected is_at_bot") } } func TestGroupChatRules(t *testing.T) { r := DefaultGroupRules() if r.MaxLength != 500 { t.Errorf("MaxLength=%d", r.MaxLength) } if r.MinGap != 3*time.Second { t.Errorf("MinGap=%v", r.MinGap) } if len(r.SilenceKeywords) == 0 { t.Error("expected silence keywords") } } func TestRouter(t *testing.T) { r := NewRouter() var received *UnifiedMessage r.SetMessageHandler(func(msg *UnifiedMessage) { received = msg }) // Verify handler is set _ = received _ = r }