@@ -107,7 +107,7 @@ describe("MSC3089TreeSpace", () => {
107
107
return Promise . resolve ( ) ;
108
108
} ) ;
109
109
client . invite = fn ;
110
- await tree . invite ( target , false , false ) ;
110
+ await tree . invite ( target , false ) ;
111
111
expect ( fn ) . toHaveBeenCalledTimes ( 1 ) ;
112
112
} ) ;
113
113
@@ -120,7 +120,7 @@ describe("MSC3089TreeSpace", () => {
120
120
return Promise . resolve ( ) ;
121
121
} ) ;
122
122
client . invite = fn ;
123
- await tree . invite ( target , false , false ) ;
123
+ await tree . invite ( target , false ) ;
124
124
expect ( fn ) . toHaveBeenCalledTimes ( 2 ) ;
125
125
} ) ;
126
126
@@ -133,7 +133,7 @@ describe("MSC3089TreeSpace", () => {
133
133
} ) ;
134
134
client . invite = fn ;
135
135
136
- await expect ( tree . invite ( target , false , false ) ) . rejects . toThrow ( "MatrixError: Sample Failure" ) ;
136
+ await expect ( tree . invite ( target , false ) ) . rejects . toThrow ( "MatrixError: Sample Failure" ) ;
137
137
138
138
expect ( fn ) . toHaveBeenCalledTimes ( 1 ) ;
139
139
} ) ;
@@ -155,61 +155,10 @@ describe("MSC3089TreeSpace", () => {
155
155
{ invite : ( userId ) => fn ( tree . roomId , userId ) } as MSC3089TreeSpace ,
156
156
] ;
157
157
158
- await tree . invite ( target , true , false ) ;
158
+ await tree . invite ( target , true ) ;
159
159
expect ( fn ) . toHaveBeenCalledTimes ( 4 ) ;
160
160
} ) ;
161
161
162
- it ( "should share keys with invitees" , async ( ) => {
163
- const target = targetUser ;
164
- const sendKeysFn = jest . fn ( ) . mockImplementation ( ( inviteRoomId : string , userIds : string [ ] ) => {
165
- expect ( inviteRoomId ) . toEqual ( roomId ) ;
166
- expect ( userIds ) . toMatchObject ( [ target ] ) ;
167
- return Promise . resolve ( ) ;
168
- } ) ;
169
- client . invite = ( ) => Promise . resolve ( { } ) ; // we're not testing this here - see other tests
170
- client . sendSharedHistoryKeys = sendKeysFn ;
171
-
172
- // Mock the history check as best as possible
173
- const historyVis = "shared" ;
174
- const historyFn = jest . fn ( ) . mockImplementation ( ( eventType : string , stateKey ?: string ) => {
175
- // We're not expecting a super rigid test: the function that calls this internally isn't
176
- // really being tested here.
177
- expect ( eventType ) . toEqual ( EventType . RoomHistoryVisibility ) ;
178
- expect ( stateKey ) . toEqual ( "" ) ;
179
- return { getContent : ( ) => ( { history_visibility : historyVis } ) } ; // eslint-disable-line camelcase
180
- } ) ;
181
- room . currentState . getStateEvents = historyFn ;
182
-
183
- // Note: inverse test is implicit from other tests, which disable the call stack of this
184
- // test in order to pass.
185
- await tree . invite ( target , false , true ) ;
186
- expect ( sendKeysFn ) . toHaveBeenCalledTimes ( 1 ) ;
187
- expect ( historyFn ) . toHaveBeenCalledTimes ( 1 ) ;
188
- } ) ;
189
-
190
- it ( "should not share keys with invitees if inappropriate history visibility" , async ( ) => {
191
- const target = targetUser ;
192
- const sendKeysFn = jest . fn ( ) . mockImplementation ( ( inviteRoomId : string , userIds : string [ ] ) => {
193
- expect ( inviteRoomId ) . toEqual ( roomId ) ;
194
- expect ( userIds ) . toMatchObject ( [ target ] ) ;
195
- return Promise . resolve ( ) ;
196
- } ) ;
197
- client . invite = ( ) => Promise . resolve ( { } ) ; // we're not testing this here - see other tests
198
- client . sendSharedHistoryKeys = sendKeysFn ;
199
-
200
- const historyVis = "joined" ; // NOTE: Changed.
201
- const historyFn = jest . fn ( ) . mockImplementation ( ( eventType : string , stateKey ?: string ) => {
202
- expect ( eventType ) . toEqual ( EventType . RoomHistoryVisibility ) ;
203
- expect ( stateKey ) . toEqual ( "" ) ;
204
- return { getContent : ( ) => ( { history_visibility : historyVis } ) } ; // eslint-disable-line camelcase
205
- } ) ;
206
- room . currentState . getStateEvents = historyFn ;
207
-
208
- await tree . invite ( target , false , true ) ;
209
- expect ( sendKeysFn ) . toHaveBeenCalledTimes ( 0 ) ;
210
- expect ( historyFn ) . toHaveBeenCalledTimes ( 1 ) ;
211
- } ) ;
212
-
213
162
async function evaluatePowerLevels ( pls : any , role : TreePermissions , expectedPl : number ) {
214
163
makePowerLevels ( pls ) ;
215
164
const fn = jest
0 commit comments