diff --git a/src/stores/oidc/OidcClientStore.ts b/src/stores/oidc/OidcClientStore.ts index 3739d1a5bc2..aafbbc6276d 100644 --- a/src/stores/oidc/OidcClientStore.ts +++ b/src/stores/oidc/OidcClientStore.ts @@ -37,7 +37,9 @@ export class OidcClientStore { if (this.authenticatedIssuer) { this.getOidcClient(); } else { - this._accountManagementEndpoint = getDelegatedAuthAccountUrl(matrixClient); + matrixClient.waitForClientWellKnown().then((wellKnown) => { + this._accountManagementEndpoint = getDelegatedAuthAccountUrl(wellKnown); + }); } } diff --git a/test/components/structures/MatrixChat-test.tsx b/test/components/structures/MatrixChat-test.tsx index 797777767cc..441de19df94 100644 --- a/test/components/structures/MatrixChat-test.tsx +++ b/test/components/structures/MatrixChat-test.tsx @@ -38,6 +38,7 @@ import { filterConsole, flushPromises, getMockClientWithEventEmitter, + mockClientMethodsServer, mockClientMethodsUser, MockClientWithEventEmitter, mockPlatformPeg, @@ -73,6 +74,7 @@ describe("", () => { // reused in createClient mock below const getMockClientMethods = () => ({ ...mockClientMethodsUser(userId), + ...mockClientMethodsServer(), getVersions: jest.fn().mockResolvedValue({ versions: SERVER_SUPPORTED_MATRIX_VERSIONS }), startClient: jest.fn(), stopClient: jest.fn(), diff --git a/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx b/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx index f1fcb88dee8..9beceb95efb 100644 --- a/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx +++ b/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx @@ -42,6 +42,7 @@ import { flushPromises, getMockClientWithEventEmitter, mkPusher, + mockClientMethodsServer, mockClientMethodsUser, mockPlatformPeg, } from "../../../../../test-utils"; @@ -167,6 +168,7 @@ describe("", () => { beforeEach(async () => { mockClient = getMockClientWithEventEmitter({ ...mockClientMethodsUser(aliceId), + ...mockClientMethodsServer(), getCrypto: jest.fn().mockReturnValue(mockCrypto), getDevices: jest.fn(), getStoredDevice: jest.fn(), @@ -180,9 +182,6 @@ describe("", () => { getPushers: jest.fn(), setPusher: jest.fn(), setLocalNotificationSettings: jest.fn(), - getVersions: jest.fn().mockResolvedValue({}), - getCapabilities: jest.fn().mockResolvedValue({}), - getClientWellKnown: jest.fn().mockReturnValue({}), }); jest.clearAllMocks(); jest.spyOn(logger, "error").mockRestore(); diff --git a/test/test-utils/client.ts b/test/test-utils/client.ts index 9c00b22c3e1..0a2e0cd617b 100644 --- a/test/test-utils/client.ts +++ b/test/test-utils/client.ts @@ -130,6 +130,7 @@ export const mockClientMethodsServer = (): Partial