mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-19 06:20:25 +00:00
fix missing mock for test
This commit is contained in:
@@ -98,14 +98,19 @@ describe("Publisher", () => {
|
||||
|
||||
(
|
||||
connection.livekitRoom.localParticipant.createTracks as Mock
|
||||
).mockResolvedValue([{}, {}]);
|
||||
).mockResolvedValue([
|
||||
{
|
||||
kind: "audio",
|
||||
mute: vi.fn(),
|
||||
},
|
||||
]);
|
||||
|
||||
await expect(publisher.createAndSetupTracks()).resolves.not.toThrow();
|
||||
expect(
|
||||
connection.livekitRoom.localParticipant.createTracks,
|
||||
).toHaveBeenCalledOnce();
|
||||
|
||||
// failiour due to localParticipant.publishTrack
|
||||
// failure due to localParticipant.publishTrack
|
||||
(
|
||||
connection.livekitRoom.localParticipant.publishTrack as Mock
|
||||
).mockRejectedValue(Error("testError"));
|
||||
@@ -114,7 +119,7 @@ describe("Publisher", () => {
|
||||
new FailToStartLivekitConnection("testError"),
|
||||
);
|
||||
|
||||
// does not try other conenction after the first one failed
|
||||
// does not try other connection after the first one failed
|
||||
expect(
|
||||
connection.livekitRoom.localParticipant.publishTrack,
|
||||
).toHaveBeenCalledTimes(1);
|
||||
@@ -145,7 +150,7 @@ describe("Publisher", () => {
|
||||
|
||||
expect(
|
||||
connection.livekitRoom.localParticipant.publishTrack,
|
||||
).toHaveBeenCalledTimes(3);
|
||||
).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -191,10 +191,14 @@ export class Publisher {
|
||||
// or only use the low level create/publish APIs and have our own pending publication protection.
|
||||
// Maybe we could change the livekit api to pre-load tracks without publishing them yet?
|
||||
// Are we sure this is needed at all? What are the gains?
|
||||
const isEnabled =
|
||||
track.kind === Track.Kind.Audio
|
||||
? this.muteStates.audio.enabled$.value
|
||||
: this.muteStates.video.enabled$.value;
|
||||
let isEnabled: boolean;
|
||||
if (track.kind === Track.Kind.Audio) {
|
||||
isEnabled = this.muteStates.audio.enabled$.value;
|
||||
} else if (track.kind === Track.Kind.Video) {
|
||||
isEnabled = this.muteStates.video.enabled$.value;
|
||||
} else {
|
||||
throw new Error("Unsupported track kind " + track.kind);
|
||||
}
|
||||
|
||||
if (!isEnabled) {
|
||||
// TODO should we also drop it?
|
||||
|
||||
Reference in New Issue
Block a user