Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit fc4866f

Browse files
committed
Add test
Signed-off-by: Michael Telatynski <[email protected]>
1 parent d292abe commit fc4866f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/SlidingSyncManager-test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
import { SlidingSync } from "matrix-js-sdk/src/sliding-sync";
1818
import { mocked } from "jest-mock";
1919
import { MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
20+
import fetchMockJest from "fetch-mock-jest";
2021

2122
import { SlidingSyncManager } from "../src/SlidingSyncManager";
2223
import { stubClient } from "./test-utils";
@@ -252,6 +253,25 @@ describe("SlidingSyncManager", () => {
252253
expect(manager.getProxyFromWellKnown).toHaveBeenCalled();
253254
expect(SlidingSyncController.serverSupportsSlidingSync).toBeTruthy();
254255
});
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+
});
255275
});
256276
describe("nativeSlidingSyncSupport", () => {
257277
beforeEach(() => {

0 commit comments

Comments
 (0)