fix test caused by remoteParticipantsWithTracks->remoteParticipants

This commit is contained in:
Timo K
2025-12-01 20:26:54 +01:00
parent 43266e6200
commit ab675cf00b
4 changed files with 13 additions and 10 deletions

View File

@@ -101,7 +101,7 @@ import { createHomeserverConnected$ } from "./localMember/HomeserverConnected.ts
import { import {
createLocalMembership$, createLocalMembership$,
enterRTCSession, enterRTCSession,
LocalMemberConnectionState, type LocalMemberConnectionState,
RTCBackendState, RTCBackendState,
} from "./localMember/LocalMembership.ts"; } from "./localMember/LocalMembership.ts";
import { createLocalTransport$ } from "./localMember/LocalTransport.ts"; import { createLocalTransport$ } from "./localMember/LocalTransport.ts";

View File

@@ -412,8 +412,10 @@ describe("Publishing participants observations", () => {
fakeRoomEventEmiter.emit(RoomEvent.ParticipantConnected, p), fakeRoomEventEmiter.emit(RoomEvent.ParticipantConnected, p),
); );
// At this point there should be no publishers // At this point there should be ~~no~~ publishers
expect(observedPublishers.pop()!.length).toEqual(0); // We do have publisher now, since we do not filter for publishers anymore (to also have participants with only data tracks)
// The filtering we do is just based on the matrixRTC member events.
expect(observedPublishers.pop()!.length).toEqual(4);
participants = [ participants = [
fakeRemoteLivekitParticipant("@alice:example.org:DEV000", 1), fakeRemoteLivekitParticipant("@alice:example.org:DEV000", 1),
@@ -453,8 +455,10 @@ describe("Publishing participants observations", () => {
fakeRoomEventEmiter.emit(RoomEvent.ParticipantConnected, participant); fakeRoomEventEmiter.emit(RoomEvent.ParticipantConnected, participant);
} }
// At this point there should be no publishers // At this point there should be ~~no~~ publishers
expect(observedPublishers.pop()!.length).toEqual(0); // We do have publisher now, since we do not filter for publishers anymore (to also have participants with only data tracks)
// The filtering we do is just based on the matrixRTC member events.
expect(observedPublishers.pop()!.length).toEqual(1);
participants = [fakeRemoteLivekitParticipant("@bob:example.org:DEV111", 1)]; participants = [fakeRemoteLivekitParticipant("@bob:example.org:DEV111", 1)];

View File

@@ -221,7 +221,7 @@ export class Connection {
this.client = client; this.client = client;
// REMOTE participants with track!!! // REMOTE participants with track!!!
// this.remoteParticipantsWithTracks$ // this.remoteParticipants$
this.remoteParticipants$ = scope.behavior( this.remoteParticipants$ = scope.behavior(
// only tracks remote participants // only tracks remote participants
connectedParticipantsObserver(this.livekitRoom, { connectedParticipantsObserver(this.livekitRoom, {

View File

@@ -52,7 +52,7 @@ beforeEach(() => {
(transport: LivekitTransport, scope: ObservableScope) => { (transport: LivekitTransport, scope: ObservableScope) => {
const mockConnection = { const mockConnection = {
transport, transport,
remoteParticipantsWithTracks$: new BehaviorSubject([]), remoteParticipants$: new BehaviorSubject([]),
} as unknown as Connection; } as unknown as Connection;
vi.mocked(mockConnection).start = vi.fn(); vi.mocked(mockConnection).start = vi.fn();
vi.mocked(mockConnection).stop = vi.fn(); vi.mocked(mockConnection).stop = vi.fn();
@@ -200,7 +200,7 @@ describe("connections$ stream", () => {
}); });
describe("connectionManagerData$ stream", () => { describe("connectionManagerData$ stream", () => {
// Used in test to control fake connections' remoteParticipantsWithTracks$ streams // Used in test to control fake connections' remoteParticipants$ streams
let fakePublishingParticipantsStreams: Map< let fakePublishingParticipantsStreams: Map<
string, string,
Behavior<LivekitParticipant[]> Behavior<LivekitParticipant[]>
@@ -232,8 +232,7 @@ describe("connectionManagerData$ stream", () => {
>([]); >([]);
const mockConnection = { const mockConnection = {
transport, transport,
remoteParticipantsWithTracks$: remoteParticipants$: getPublishingParticipantsFor(transport),
getPublishingParticipantsFor(transport),
} as unknown as Connection; } as unknown as Connection;
vi.mocked(mockConnection).start = vi.fn(); vi.mocked(mockConnection).start = vi.fn();
vi.mocked(mockConnection).stop = vi.fn(); vi.mocked(mockConnection).stop = vi.fn();