-
-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the js-sdk compatible with MSC preferred foci and active focus. (#…
…4195) * 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>
- Loading branch information
1 parent
7ecaa53
commit d754392
Showing
10 changed files
with
649 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
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(); | ||
}); | ||
}); |
Oops, something went wrong.