@@ -17,7 +17,7 @@ limitations under the License.
17
17
import React from "react" ;
18
18
import { TooltipProvider } from "@vector-im/compound-web" ;
19
19
import { fireEvent , getByLabelText , render , screen } from "@testing-library/react" ;
20
- import { JoinRule , Room } from "matrix-js-sdk/src/matrix" ;
20
+ import { EventTimeline , JoinRule , Room } from "matrix-js-sdk/src/matrix" ;
21
21
import { KnownMembership } from "matrix-js-sdk/src/types" ;
22
22
23
23
import { SDKContext , SdkContextClass } from "../../../../../src/contexts/SDKContext" ;
@@ -136,6 +136,7 @@ describe("<CallGuestLinkButton />", () => {
136
136
expect ( callParams [ 1 ] . subtitle ) . toEqual ( expectedShareDialogProps . subtitle ) ;
137
137
expect ( callParams [ 1 ] . customTitle ) . toEqual ( expectedShareDialogProps . customTitle ) ;
138
138
} ) ;
139
+
139
140
it ( "shows the ShareDialog on click with knock join rules" , ( ) => {
140
141
jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Knock ) ;
141
142
getComponent ( room ) ;
@@ -147,6 +148,16 @@ describe("<CallGuestLinkButton />", () => {
147
148
expect ( callParams [ 1 ] . customTitle ) . toEqual ( expectedShareDialogProps . customTitle ) ;
148
149
} ) ;
149
150
151
+ it ( "don't show external conference button if room not public nor knock and the user cannot change join rules" , ( ) => {
152
+ jest . spyOn ( room , "getLiveTimeline" ) . mockReturnValue ( {
153
+ getState : jest . fn ( ) . mockReturnValue ( {
154
+ maySendStateEvent : jest . fn ( ) . mockReturnValue ( false ) ,
155
+ } ) ,
156
+ } as unknown as EventTimeline ) ;
157
+ getComponent ( room ) ;
158
+ expect ( screen . queryByLabelText ( "Share call link" ) ) . not . toBeInTheDocument ( ) ;
159
+ } ) ;
160
+
150
161
it ( "don't show external conference button if now guest spa link is configured" , ( ) => {
151
162
jest . spyOn ( room , "getJoinRule" ) . mockReturnValue ( JoinRule . Public ) ;
152
163
jest . spyOn ( SdkContextClass . instance . roomViewStore , "isViewingCall" ) . mockReturnValue ( true ) ;
0 commit comments