You've already forked matrix-js-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-js-sdk.git
				synced 2025-11-03 01:53:18 +03:00 
			
		
		
		
	* WIP * temp Signed-off-by: Timo K <toger5@hotmail.de> * Fix imports * Fix checkSessionsMembershipData thinking foci_preferred is required * incorporate CallMembership changes - rename Focus -> Transport - add RtcMembershipData (next to `sessionMembershipData`) - make `new CallMembership` initializable with both - move oldest member calculation into CallMembership Signed-off-by: Timo K <toger5@hotmail.de> * use correct event type Signed-off-by: Timo K <toger5@hotmail.de> * fix sonar cube conerns Signed-off-by: Timo K <toger5@hotmail.de> * callMembership tests Signed-off-by: Timo K <toger5@hotmail.de> * make test correct Signed-off-by: Timo K <toger5@hotmail.de> * make sonar cube happy (it does not know about the type constraints...) Signed-off-by: Timo K <toger5@hotmail.de> * remove created_ts from RtcMembership Signed-off-by: Timo K <toger5@hotmail.de> * fix imports Signed-off-by: Timo K <toger5@hotmail.de> * Update src/matrixrtc/IMembershipManager.ts Co-authored-by: Robin <robin@robin.town> * rename LivekitFocus.ts -> LivekitTransport.ts Signed-off-by: Timo K <toger5@hotmail.de> * add details to `getTransport` Signed-off-by: Timo K <toger5@hotmail.de> * review Signed-off-by: Timo K <toger5@hotmail.de> * use DEFAULT_EXPIRE_DURATION in tests Signed-off-by: Timo K <toger5@hotmail.de> * fix test `does not provide focus if the selection method is unknown` Signed-off-by: Timo K <toger5@hotmail.de> * Update src/matrixrtc/CallMembership.ts Co-authored-by: Robin <robin@robin.town> * Move `m.call.intent` into the `application` section for rtc member events. Signed-off-by: Timo K <toger5@hotmail.de> * review on rtc object validation code. Signed-off-by: Timo K <toger5@hotmail.de> * user id check Signed-off-by: Timo K <toger5@hotmail.de> * review: Refactor RTC membership handling and improve error handling Signed-off-by: Timo K <toger5@hotmail.de> * docstring updates Signed-off-by: Timo K <toger5@hotmail.de> * add back deprecated `getFocusInUse` & `getActiveFocus` Signed-off-by: Timo K <toger5@hotmail.de> * ci Signed-off-by: Timo K <toger5@hotmail.de> * Update src/matrixrtc/CallMembership.ts Co-authored-by: Robin <robin@robin.town> * lint Signed-off-by: Timo K <toger5@hotmail.de> * make test less strict for ew tests Signed-off-by: Timo K <toger5@hotmail.de> * Typescript downstream test adjustments Signed-off-by: Timo K <toger5@hotmail.de> * err Signed-off-by: Timo K <toger5@hotmail.de> --------- Signed-off-by: Timo K <toger5@hotmail.de> Co-authored-by: Robin <robin@robin.town>
		
			
				
	
	
		
			65 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			2.5 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 {
 | 
						|
    isLivekitTransport,
 | 
						|
    isLivekitFocusSelection,
 | 
						|
    isLivekitTransportConfig,
 | 
						|
} from "../../../src/matrixrtc/LivekitTransport";
 | 
						|
 | 
						|
describe("LivekitFocus", () => {
 | 
						|
    it("isLivekitFocus", () => {
 | 
						|
        expect(
 | 
						|
            isLivekitTransport({
 | 
						|
                type: "livekit",
 | 
						|
                livekit_service_url: "http://test.com",
 | 
						|
                livekit_alias: "test",
 | 
						|
            }),
 | 
						|
        ).toBeTruthy();
 | 
						|
        expect(isLivekitTransport({ type: "livekit" })).toBeFalsy();
 | 
						|
        expect(
 | 
						|
            isLivekitTransport({ type: "not-livekit", livekit_service_url: "http://test.com", livekit_alias: "test" }),
 | 
						|
        ).toBeFalsy();
 | 
						|
        expect(
 | 
						|
            isLivekitTransport({ type: "livekit", other_service_url: "http://test.com", livekit_alias: "test" }),
 | 
						|
        ).toBeFalsy();
 | 
						|
        expect(
 | 
						|
            isLivekitTransport({ type: "livekit", livekit_service_url: "http://test.com", other_alias: "test" }),
 | 
						|
        ).toBeFalsy();
 | 
						|
    });
 | 
						|
    it("isLivekitFocusActive", () => {
 | 
						|
        expect(
 | 
						|
            isLivekitFocusSelection({
 | 
						|
                type: "livekit",
 | 
						|
                focus_selection: "oldest_membership",
 | 
						|
            }),
 | 
						|
        ).toBeTruthy();
 | 
						|
        expect(isLivekitFocusSelection({ type: "livekit" })).toBeFalsy();
 | 
						|
        expect(isLivekitFocusSelection({ type: "not-livekit", focus_selection: "oldest_membership" })).toBeFalsy();
 | 
						|
    });
 | 
						|
    it("isLivekitFocusConfig", () => {
 | 
						|
        expect(
 | 
						|
            isLivekitTransportConfig({
 | 
						|
                type: "livekit",
 | 
						|
                livekit_service_url: "http://test.com",
 | 
						|
            }),
 | 
						|
        ).toBeTruthy();
 | 
						|
        expect(isLivekitTransportConfig({ type: "livekit" })).toBeFalsy();
 | 
						|
        expect(isLivekitTransportConfig({ type: "not-livekit", livekit_service_url: "http://test.com" })).toBeFalsy();
 | 
						|
        expect(isLivekitTransportConfig({ type: "livekit", other_service_url: "oldest_membership" })).toBeFalsy();
 | 
						|
    });
 | 
						|
});
 |