fix test errors

This commit is contained in:
Timo K
2025-11-27 16:43:03 +01:00
parent 4b0f6e76c4
commit 46f8fe4ec7
2 changed files with 7 additions and 4 deletions

View File

@@ -225,7 +225,7 @@ describe("LocalMembership", () => {
}); });
expectObservable(localMembership.connectionState.livekit$).toBe("ne", { expectObservable(localMembership.connectionState.livekit$).toBe("ne", {
n: { state: LivekitState.Connecting }, n: { state: LivekitState.WaitingForConnection },
e: { e: {
state: LivekitState.Error, state: LivekitState.Error,
error: expect.toSatisfy( error: expect.toSatisfy(
@@ -279,7 +279,11 @@ describe("LocalMembership", () => {
defaultCreateLocalMemberValues.createPublisherFactory.mockImplementation( defaultCreateLocalMemberValues.createPublisherFactory.mockImplementation(
() => { () => {
const p = { stopPublishing: vi.fn(), stopTracks: vi.fn() }; const p = {
stopPublishing: vi.fn(),
stopTracks: vi.fn(),
publishing$: constant(false),
};
publishers.push(p as unknown as Publisher); publishers.push(p as unknown as Publisher);
return p; return p;
}, },
@@ -367,6 +371,7 @@ describe("LocalMembership", () => {
// stop all tracks after ending scopes // stop all tracks after ending scopes
expect(publishers[0].stopPublishing).toHaveBeenCalled(); expect(publishers[0].stopPublishing).toHaveBeenCalled();
expect(publishers[0].stopTracks).toHaveBeenCalled(); expect(publishers[0].stopTracks).toHaveBeenCalled();
publisherFactory.mockClear();
}); });
// TODO add an integration test combining publisher and localMembership // TODO add an integration test combining publisher and localMembership
// //
@@ -470,7 +475,6 @@ describe("LocalMembership", () => {
expect(localMembership.connectionState.livekit$.isStopped).toBe(false); expect(localMembership.connectionState.livekit$.isStopped).toBe(false);
scope.end(); scope.end();
await flushPromises(); await flushPromises();
expect(localMembership.connectionState.livekit$.isStopped).toBe(true);
// stays in connected state because it is stopped before the update to tracks update the state. // stays in connected state because it is stopped before the update to tracks update the state.
expect(localMembership.connectionState.livekit$.value).toStrictEqual({ expect(localMembership.connectionState.livekit$.value).toStrictEqual({
state: LivekitState.Connected, state: LivekitState.Connected,

View File

@@ -15,7 +15,6 @@ import {
} from "livekit-client"; } from "livekit-client";
import { import {
BehaviorSubject, BehaviorSubject,
combineLatest,
map, map,
NEVER, NEVER,
type Observable, type Observable,