fix: harden group lifecycle and registration writes

This commit is contained in:
richjohnrambo
2026-09-14 12:04:10 +08:00
parent 990526647c
commit 4854e090ef
9 changed files with 182 additions and 28 deletions
+20
View File
@@ -613,6 +613,26 @@ func TestVideoCallStaleUnanswered(t *testing.T) {
}
}
func TestNormalizeCallEventAliases(t *testing.T) {
for _, event := range []string{"hang-up", "hangup", "hang_up", "finish", "finished", "end", "ended", "disconnect", "disconnected"} {
if got := normalizeCallEvent(event); got != constCallEventHangUp {
t.Fatalf("normalizeCallEvent(%q) = %q, want %q", event, got, constCallEventHangUp)
}
if !isDetachedCallEvent(event) {
t.Fatalf("isDetachedCallEvent(%q) = false, want true", event)
}
}
if got := normalizeCallEvent(constCallEventAccept); got != constCallEventAccept {
t.Fatalf("normalizeCallEvent(%q) = %q, want %q", constCallEventAccept, got, constCallEventAccept)
}
if !isDetachedCallEvent(constCallEventAccept) {
t.Fatalf("isDetachedCallEvent(%q) = false, want true", constCallEventAccept)
}
if isDetachedCallEvent("unknown") {
t.Fatal("isDetachedCallEvent(\"unknown\") = true, want false")
}
}
func TestHandleBroadcastDataGroup(t *testing.T) {
topicName := "grp-test"
numUsers := 4