@@ -17,6 +17,7 @@ limitations under the License.
17
17
import { SlidingSync } from "matrix-js-sdk/src/sliding-sync" ;
18
18
import { mocked } from "jest-mock" ;
19
19
import { MatrixClient , MatrixEvent , Room } from "matrix-js-sdk/src/matrix" ;
20
+ import fetchMockJest from "fetch-mock-jest" ;
20
21
21
22
import { SlidingSyncManager } from "../src/SlidingSyncManager" ;
22
23
import { stubClient } from "./test-utils" ;
@@ -252,6 +253,25 @@ describe("SlidingSyncManager", () => {
252
253
expect ( manager . getProxyFromWellKnown ) . toHaveBeenCalled ( ) ;
253
254
expect ( SlidingSyncController . serverSupportsSlidingSync ) . toBeTruthy ( ) ;
254
255
} ) ;
256
+ it ( "should query well-known on server_name not baseUrl" , async ( ) => {
257
+ fetchMockJest . get ( "https://matrix.org/.well-known/matrix/client" , {
258
+ "m.homeserver" : {
259
+ base_url : "https://matrix-client.matrix.org" ,
260
+ server : "matrix.org" ,
261
+ } ,
262
+ "org.matrix.msc3575.proxy" : {
263
+ url : "proxy" ,
264
+ } ,
265
+ } ) ;
266
+ fetchMockJest . get ( "https://matrix-client.matrix.org/_matrix/client/versions" , { versions : [ "v1.4" ] } ) ;
267
+
268
+ mocked ( manager . getProxyFromWellKnown ) . mockRestore ( ) ;
269
+ jest . spyOn ( manager , "nativeSlidingSyncSupport" ) . mockResolvedValue ( false ) ;
270
+ expect ( SlidingSyncController . serverSupportsSlidingSync ) . toBeFalsy ( ) ;
271
+ await manager . checkSupport ( client ) ;
272
+ expect ( SlidingSyncController . serverSupportsSlidingSync ) . toBeTruthy ( ) ;
273
+ expect ( fetchMockJest ) . not . toHaveFetched ( "https://matrix-client.matrix.org/.well-known/matrix/client" ) ;
274
+ } ) ;
255
275
} ) ;
256
276
describe ( "nativeSlidingSyncSupport" , ( ) => {
257
277
beforeEach ( ( ) => {
0 commit comments