mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-06-08 15:21:53 +03:00
* Refactor to preferred and active foci. Signed-off-by: Timo K <toger5@hotmail.de> * make the sdk compatible with MSC4143 but still be backwards compatible * comment fixes * also fallback to legacy if the current member event is legacy * use XOR types * use EitherAnd * make livekit Foucs types simpler * review * fix tests * test work * more review + more tests * remove unnecassary await that is in conflict with the comment * make joinRoomSession sync * Update src/matrixrtc/MatrixRTCSession.ts Co-authored-by: Andrew Ferrazzutti <af_0_af@hotmail.com> * review * fix * test * review * review * comment clarification * typo --------- Signed-off-by: Timo K <toger5@hotmail.de> Co-authored-by: Andrew Ferrazzutti <af_0_af@hotmail.com>
61 lines
2.4 KiB
TypeScript
61 lines
2.4 KiB
TypeScript
/*
|
|
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
import { isLivekitFocus, isLivekitFocusActive, isLivekitFocusConfig } from "../../../src/matrixrtc/LivekitFocus";
|
|
|
|
describe("LivekitFocus", () => {
|
|
it("isLivekitFocus", () => {
|
|
expect(
|
|
isLivekitFocus({
|
|
type: "livekit",
|
|
livekit_service_url: "http://test.com",
|
|
livekit_alias: "test",
|
|
}),
|
|
).toBeTruthy();
|
|
expect(isLivekitFocus({ type: "livekit" })).toBeFalsy();
|
|
expect(
|
|
isLivekitFocus({ type: "not-livekit", livekit_service_url: "http://test.com", livekit_alias: "test" }),
|
|
).toBeFalsy();
|
|
expect(
|
|
isLivekitFocus({ type: "livekit", other_service_url: "http://test.com", livekit_alias: "test" }),
|
|
).toBeFalsy();
|
|
expect(
|
|
isLivekitFocus({ type: "livekit", livekit_service_url: "http://test.com", other_alias: "test" }),
|
|
).toBeFalsy();
|
|
});
|
|
it("isLivekitFocusActive", () => {
|
|
expect(
|
|
isLivekitFocusActive({
|
|
type: "livekit",
|
|
focus_selection: "oldest_membership",
|
|
}),
|
|
).toBeTruthy();
|
|
expect(isLivekitFocusActive({ type: "livekit" })).toBeFalsy();
|
|
expect(isLivekitFocusActive({ type: "not-livekit", focus_selection: "oldest_membership" })).toBeFalsy();
|
|
});
|
|
it("isLivekitFocusConfig", () => {
|
|
expect(
|
|
isLivekitFocusConfig({
|
|
type: "livekit",
|
|
livekit_service_url: "http://test.com",
|
|
}),
|
|
).toBeTruthy();
|
|
expect(isLivekitFocusConfig({ type: "livekit" })).toBeFalsy();
|
|
expect(isLivekitFocusConfig({ type: "not-livekit", livekit_service_url: "http://test.com" })).toBeFalsy();
|
|
expect(isLivekitFocusConfig({ type: "livekit", other_service_url: "oldest_membership" })).toBeFalsy();
|
|
});
|
|
});
|