mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
fix: resolve CI failures — coverage exclusion and stale test removal
- Exclude voiceSession.ts from coverage (browser API dependency, same
pattern as audio.ts/vad.ts/webrtc.ts)
- Remove stale TestHub_Register_CleansUpOldVoiceState test that tested
old duplicate-login behavior removed in b53c729
This commit is contained in:
@@ -25,6 +25,7 @@ export default defineConfig({
|
||||
"src/lib/audio.ts",
|
||||
"src/lib/vad.ts",
|
||||
"src/lib/webrtc.ts",
|
||||
"src/lib/voiceSession.ts",
|
||||
],
|
||||
thresholds: {
|
||||
statements: 80,
|
||||
|
||||
+5
-33
@@ -673,39 +673,11 @@ func TestHub_CleanupVoiceForChannel_BroadcastsVoiceLeave(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Hub.Register voice state cleanup ────────────────────────────────────────
|
||||
|
||||
func TestHub_Register_CleansUpOldVoiceState(t *testing.T) {
|
||||
// Use voiceHub (has voice_states table) so handleVoiceJoin succeeds.
|
||||
hub, database := newVoiceHub(t)
|
||||
|
||||
user := seedVoiceOwner(t, database, "register-voice-user")
|
||||
chID := seedVoiceChan(t, database, "vc-register-voice")
|
||||
|
||||
// Create the voice room and register the first client.
|
||||
room := hub.GetOrCreateVoiceRoom(chID, ws.VoiceRoomConfig{ChannelID: chID, Quality: "medium"})
|
||||
|
||||
send1 := make(chan []byte, 16)
|
||||
c1 := ws.NewTestClientWithUser(hub, user, chID, send1)
|
||||
if err := room.AddParticipant(user.ID); err != nil {
|
||||
t.Fatalf("AddParticipant: %v", err)
|
||||
}
|
||||
ws.SetClientVoiceChID(c1, chID)
|
||||
|
||||
hub.Register(c1)
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
|
||||
// Register a second client for the same user — should evict the first.
|
||||
send2 := make(chan []byte, 16)
|
||||
c2 := ws.NewTestClientWithUser(hub, user, chID, send2)
|
||||
hub.Register(c2)
|
||||
time.Sleep(30 * time.Millisecond)
|
||||
|
||||
// The old client's voice state in the room should be cleaned up.
|
||||
if room.HasParticipant(user.ID) {
|
||||
t.Error("expected old client's voice participation to be cleaned up after re-register")
|
||||
}
|
||||
}
|
||||
// TestHub_Register_CleansUpOldVoiceState was removed because duplicate
|
||||
// logins are now rejected at the WebSocket handshake level (commit 00bbb46)
|
||||
// before hub.Register is called. The hub's register case simply overwrites
|
||||
// the client map entry; voice cleanup for disconnects is handled by
|
||||
// handleVoiceLeave called from readPump/ICE monitor.
|
||||
|
||||
// hubTestSchema is the minimal schema needed for hub tests.
|
||||
var hubTestSchema = []byte(`
|
||||
|
||||
Reference in New Issue
Block a user