Unify LiveKit and Matrix connection states

This commit is contained in:
Timo K
2025-12-02 19:40:08 +01:00
parent f05d4b158e
commit 2e646bfac1
10 changed files with 238 additions and 233 deletions

View File

@@ -125,7 +125,10 @@ function setupRemoteConnection(): Connection {
};
});
fakeLivekitRoom.connect.mockResolvedValue(undefined);
fakeLivekitRoom.connect.mockImplementation(async (): Promise<void> => {
fakeLivekitRoom.state = LivekitConnectionState.Connected;
return Promise.resolve();
});
return new Connection(opts, logger);
}
@@ -309,7 +312,7 @@ describe("Start connection states", () => {
capturedState = capturedStates.pop();
if (capturedState && capturedState?.state === "FailedToStart") {
if (capturedState && capturedState.state === "FailedToStart") {
expect(capturedState.error.message).toContain(
"Failed to connect to livekit",
);
@@ -345,7 +348,7 @@ describe("Start connection states", () => {
const connectingState = capturedStates.shift();
expect(connectingState?.state).toEqual("ConnectingToLkRoom");
const connectedState = capturedStates.shift();
expect(connectedState?.state).toEqual("ConnectedToLkRoom");
expect(connectedState?.state).toEqual("connected");
});
it("shutting down the scope should stop the connection", async () => {