@@ -103,7 +103,7 @@ describe("MatrixClient", function() {
103103 ] ;
104104 let acceptKeepalives : boolean ;
105105 let pendingLookup = null ;
106- function httpReq ( cb , method , path , qp , data , prefix ) {
106+ function httpReq ( method , path , qp , data , prefix ) {
107107 if ( path === KEEP_ALIVE_PATH && acceptKeepalives ) {
108108 return Promise . resolve ( {
109109 unstable_features : {
@@ -1153,8 +1153,7 @@ describe("MatrixClient", function() {
11531153
11541154 // event type combined
11551155 const expectedEventType = M_BEACON_INFO . name ;
1156- const [ callback , method , path , queryParams , requestContent ] = client . http . authedRequest . mock . calls [ 0 ] ;
1157- expect ( callback ) . toBeFalsy ( ) ;
1156+ const [ method , path , queryParams , requestContent ] = client . http . authedRequest . mock . calls [ 0 ] ;
11581157 expect ( method ) . toBe ( 'PUT' ) ;
11591158 expect ( path ) . toEqual (
11601159 `/rooms/${ encodeURIComponent ( roomId ) } /state/` +
@@ -1168,7 +1167,7 @@ describe("MatrixClient", function() {
11681167 await client . unstable_setLiveBeacon ( roomId , content ) ;
11691168
11701169 // event type combined
1171- const [ , , path , , requestContent ] = client . http . authedRequest . mock . calls [ 0 ] ;
1170+ const [ , path , , requestContent ] = client . http . authedRequest . mock . calls [ 0 ] ;
11721171 expect ( path ) . toEqual (
11731172 `/rooms/${ encodeURIComponent ( roomId ) } /state/` +
11741173 `${ encodeURIComponent ( M_BEACON_INFO . name ) } /${ encodeURIComponent ( userId ) } ` ,
@@ -1229,7 +1228,7 @@ describe("MatrixClient", function() {
12291228 it ( "is called with plain text topic and callback and sends state event" , async ( ) => {
12301229 const sendStateEvent = createSendStateEventMock ( "pizza" ) ;
12311230 client . sendStateEvent = sendStateEvent ;
1232- await client . setRoomTopic ( roomId , "pizza" , ( ) => { } ) ;
1231+ await client . setRoomTopic ( roomId , "pizza" ) ;
12331232 expect ( sendStateEvent ) . toHaveBeenCalledTimes ( 1 ) ;
12341233 } ) ;
12351234
@@ -1244,15 +1243,9 @@ describe("MatrixClient", function() {
12441243 describe ( "setPassword" , ( ) => {
12451244 const auth = { session : 'abcdef' , type : 'foo' } ;
12461245 const newPassword = 'newpassword' ;
1247- const callback = ( ) => { } ;
1248-
1249- const passwordTest = ( expectedRequestContent : any , expectedCallback ?: Function ) => {
1250- const [ callback , method , path , queryParams , requestContent ] = client . http . authedRequest . mock . calls [ 0 ] ;
1251- if ( expectedCallback ) {
1252- expect ( callback ) . toBe ( expectedCallback ) ;
1253- } else {
1254- expect ( callback ) . toBeFalsy ( ) ;
1255- }
1246+
1247+ const passwordTest = ( expectedRequestContent : any ) => {
1248+ const [ method , path , queryParams , requestContent ] = client . http . authedRequest . mock . calls [ 0 ] ;
12561249 expect ( method ) . toBe ( 'POST' ) ;
12571250 expect ( path ) . toEqual ( '/account/password' ) ;
12581251 expect ( queryParams ) . toBeFalsy ( ) ;
@@ -1269,8 +1262,8 @@ describe("MatrixClient", function() {
12691262 } ) ;
12701263
12711264 it ( "no logout_devices specified + callback" , async ( ) => {
1272- await client . setPassword ( auth , newPassword , callback ) ;
1273- passwordTest ( { auth, new_password : newPassword } , callback ) ;
1265+ await client . setPassword ( auth , newPassword ) ;
1266+ passwordTest ( { auth, new_password : newPassword } ) ;
12741267 } ) ;
12751268
12761269 it ( "overload logoutDevices=true" , async ( ) => {
@@ -1279,8 +1272,8 @@ describe("MatrixClient", function() {
12791272 } ) ;
12801273
12811274 it ( "overload logoutDevices=true + callback" , async ( ) => {
1282- await client . setPassword ( auth , newPassword , true , callback ) ;
1283- passwordTest ( { auth, new_password : newPassword , logout_devices : true } , callback ) ;
1275+ await client . setPassword ( auth , newPassword , true ) ;
1276+ passwordTest ( { auth, new_password : newPassword , logout_devices : true } ) ;
12841277 } ) ;
12851278
12861279 it ( "overload logoutDevices=false" , async ( ) => {
@@ -1289,8 +1282,8 @@ describe("MatrixClient", function() {
12891282 } ) ;
12901283
12911284 it ( "overload logoutDevices=false + callback" , async ( ) => {
1292- await client . setPassword ( auth , newPassword , false , callback ) ;
1293- passwordTest ( { auth, new_password : newPassword , logout_devices : false } , callback ) ;
1285+ await client . setPassword ( auth , newPassword , false ) ;
1286+ passwordTest ( { auth, new_password : newPassword , logout_devices : false } ) ;
12941287 } ) ;
12951288 } ) ;
12961289
@@ -1305,8 +1298,7 @@ describe("MatrixClient", function() {
13051298 const result = await client . getLocalAliases ( roomId ) ;
13061299
13071300 // Current version of the endpoint we support is v3
1308- const [ callback , method , path , queryParams , data , opts ] = client . http . authedRequest . mock . calls [ 0 ] ;
1309- expect ( callback ) . toBeFalsy ( ) ;
1301+ const [ method , path , queryParams , data , opts ] = client . http . authedRequest . mock . calls [ 0 ] ;
13101302 expect ( data ) . toBeFalsy ( ) ;
13111303 expect ( method ) . toBe ( 'GET' ) ;
13121304 expect ( path ) . toEqual ( `/rooms/${ encodeURIComponent ( roomId ) } /aliases` ) ;
0 commit comments