@@ -61,8 +61,7 @@ import { _t } from "../../../../src/languageHandler";
61
61
import * as UseCall from "../../../../src/hooks/useCall" ;
62
62
import { SdkContextClass } from "../../../../src/contexts/SDKContext" ;
63
63
import WidgetStore , { IApp } from "../../../../src/stores/WidgetStore" ;
64
- import ShareDialog from "../../../../src/components/views/dialogs/ShareDialog" ;
65
- import Modal from "../../../../src/Modal" ;
64
+
66
65
jest . mock ( "../../../../src/utils/ShieldUtils" ) ;
67
66
68
67
function getWrapper ( ) : RenderOptions {
@@ -516,39 +515,12 @@ describe("RoomHeader", () => {
516
515
const { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
517
516
getByLabelText ( container , "Close lobby" ) ;
518
517
} ) ;
519
- } ) ;
520
-
521
- describe ( "External conference" , ( ) => {
522
- const oldGet = SdkConfig . get ;
523
- beforeEach ( ( ) => {
524
- jest . spyOn ( SdkConfig , "get" ) . mockImplementation ( ( key ) => {
525
- if ( key === "element_call" ) {
526
- return { guest_spa_url : "https://guest_spa_url.com" , url : "https://spa_url.com" } ;
527
- }
528
- return oldGet ( key ) ;
529
- } ) ;
530
- mockRoomMembers ( room , 3 ) ;
531
- jest . spyOn ( SdkContextClass . instance . roomViewStore , "isViewingCall" ) . mockReturnValue ( true ) ;
532
- } ) ;
533
-
534
- it ( "shows the external conference if the room has public join rules" , ( ) => {
535
- jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Public ) ;
536
-
537
- const { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
538
- expect ( getByLabelText ( container , _t ( "voip|get_call_link" ) ) ) . toBeInTheDocument ( ) ;
539
- } ) ;
540
-
541
- it ( "shows the external conference if the room has Knock join rules" , ( ) => {
542
- jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Knock ) ;
543
-
544
- const { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
545
- expect ( getByLabelText ( container , _t ( "voip|get_call_link" ) ) ) . toBeInTheDocument ( ) ;
546
- } ) ;
547
518
548
519
it ( "don't show external conference button if the call is not shown" , ( ) => {
549
- jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Public ) ;
550
520
jest . spyOn ( SdkContextClass . instance . roomViewStore , "isViewingCall" ) . mockReturnValue ( false ) ;
551
-
521
+ jest . spyOn ( SdkConfig , "get" ) . mockImplementation ( ( key ) => {
522
+ return { guest_spa_url : "https://guest_spa_url.com" , url : "https://spa_url.com" } ;
523
+ } ) ;
552
524
let { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
553
525
expect ( screen . queryByLabelText ( _t ( "voip|get_call_link" ) ) ) . not . toBeInTheDocument ( ) ;
554
526
@@ -558,69 +530,6 @@ describe("RoomHeader", () => {
558
530
559
531
expect ( getByLabelText ( container , _t ( "voip|get_call_link" ) ) ) . toBeInTheDocument ( ) ;
560
532
} ) ;
561
-
562
- it ( "don't show external conference button if now guest spa link is configured" , ( ) => {
563
- jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Public ) ;
564
- jest . spyOn ( SdkContextClass . instance . roomViewStore , "isViewingCall" ) . mockReturnValue ( true ) ;
565
-
566
- jest . spyOn ( SdkConfig , "get" ) . mockImplementation ( ( key ) => {
567
- if ( key === "element_call" ) {
568
- return { url : "https://example2.com" } ;
569
- }
570
- return oldGet ( key ) ;
571
- } ) ;
572
-
573
- render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
574
-
575
- // We only change the SdkConfig and show that this everything else is
576
- // configured so that the call link button is shown.
577
-
578
- jest . spyOn ( SdkConfig , "get" ) . mockImplementation ( ( key ) => {
579
- if ( key === "element_call" ) {
580
- return { guest_spa_url : "https://guest_spa_url.com" , url : "https://example2.com" } ;
581
- }
582
- return oldGet ( key ) ;
583
- } ) ;
584
-
585
- expect ( screen . queryByLabelText ( _t ( "voip|get_call_link" ) ) ) . not . toBeInTheDocument ( ) ;
586
- const { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
587
- expect ( getByLabelText ( container , _t ( "voip|get_call_link" ) ) ) . toBeInTheDocument ( ) ;
588
- } ) ;
589
- it ( "opens the share dialog with the correct share link in an encrypted room" , ( ) => {
590
- jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Public ) ;
591
- jest . spyOn ( SdkContextClass . instance . roomViewStore , "isViewingCall" ) . mockReturnValue ( true ) ;
592
- jest . spyOn ( room , "hasEncryptionStateEvent" ) . mockReturnValue ( true ) ;
593
-
594
- const { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
595
- const modalSpy = jest . spyOn ( Modal , "createDialog" ) ;
596
- fireEvent . click ( getByLabelText ( container , _t ( "voip|get_call_link" ) ) ) ;
597
- const target =
598
- "https://guest_spa_url.com/room/#/!1:example.org?roomId=%211%3Aexample.org&perParticipantE2EE=true&viaServers=example.org" ;
599
- expect ( modalSpy ) . toHaveBeenCalled ( ) ;
600
- const arg0 = modalSpy . mock . calls [ 0 ] [ 0 ] ;
601
- const arg1 = modalSpy . mock . calls [ 0 ] [ 1 ] as any ;
602
- expect ( arg0 ) . toEqual ( ShareDialog ) ;
603
- const { customTitle, subtitle } = arg1 ;
604
- expect ( { customTitle, subtitle } ) . toEqual ( {
605
- customTitle : "Conference invite link" ,
606
- subtitle : _t ( "share|share_call_subtitle" ) ,
607
- } ) ;
608
- expect ( arg1 . target . toString ( ) ) . toEqual ( target ) ;
609
- } ) ;
610
-
611
- it ( "share dialog has correct link in an unencrypted room" , ( ) => {
612
- jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Public ) ;
613
- jest . spyOn ( room , "hasEncryptionStateEvent" ) . mockReturnValue ( false ) ;
614
- jest . spyOn ( SdkContextClass . instance . roomViewStore , "isViewingCall" ) . mockReturnValue ( true ) ;
615
-
616
- const { container } = render ( < RoomHeader room = { room } /> , getWrapper ( ) ) ;
617
- const modalSpy = jest . spyOn ( Modal , "createDialog" ) ;
618
- fireEvent . click ( getByLabelText ( container , _t ( "voip|get_call_link" ) ) ) ;
619
- const target =
620
- "https://guest_spa_url.com/room/#/!1:example.org?roomId=%211%3Aexample.org&viaServers=example.org" ;
621
- const arg1 = modalSpy . mock . calls [ 0 ] [ 1 ] as any ;
622
- expect ( arg1 . target . toString ( ) ) . toEqual ( target ) ;
623
- } ) ;
624
533
} ) ;
625
534
626
535
describe ( "public room" , ( ) => {
0 commit comments