Stop using deprecated js-sdk fields (#30552)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-08-12 14:19:50 +01:00
committed by GitHub
parent 789dba7b3d
commit e880a866ed
3 changed files with 7 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details.
import EventEmitter from "events"; import EventEmitter from "events";
import { type MethodLikeKeys, mocked, type MockedObject, type PropertyLikeKeys } from "jest-mock"; import { type MethodLikeKeys, mocked, type MockedObject, type PropertyLikeKeys } from "jest-mock";
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature"; import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
import { type MatrixClient, type Room, MatrixError, User } from "matrix-js-sdk/src/matrix"; import { type MatrixClient, type Room, User } from "matrix-js-sdk/src/matrix";
import { MatrixClientPeg } from "../../src/MatrixClientPeg"; import { MatrixClientPeg } from "../../src/MatrixClientPeg";
@@ -138,7 +138,6 @@ export const mockClientMethodsServer = (): Partial<Record<MethodLikeKeys<MatrixC
isVersionSupported: jest.fn().mockResolvedValue(false), isVersionSupported: jest.fn().mockResolvedValue(false),
getVersions: jest.fn().mockResolvedValue({}), getVersions: jest.fn().mockResolvedValue({}),
isFallbackICEServerAllowed: jest.fn(), isFallbackICEServerAllowed: jest.fn(),
getAuthIssuer: jest.fn().mockRejectedValue(new MatrixError({ errcode: "M_UNKNOWN" }, 404)),
}); });
export const mockClientMethodsDevice = ( export const mockClientMethodsDevice = (

View File

@@ -125,8 +125,8 @@ describe("DecryptionFailureTracker", function () {
// use three different errors so that we can distinguish the reports // use three different errors so that we can distinguish the reports
const error1 = DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID; const error1 = DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID;
const error2 = DecryptionFailureCode.MEGOLM_BAD_ROOM; const error2 = DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE;
const error3 = DecryptionFailureCode.MEGOLM_MISSING_FIELDS; const error3 = DecryptionFailureCode.MEGOLM_KEY_WITHHELD;
// event that will be marked as visible before it's marked as undecryptable // event that will be marked as visible before it's marked as undecryptable
const markedVisibleFirst = await createFailedDecryptionEvent({ code: error1 }); const markedVisibleFirst = await createFailedDecryptionEvent({ code: error1 });
@@ -536,8 +536,8 @@ describe("DecryptionFailureTracker", function () {
// use three different errors so that we can distinguish the reports // use three different errors so that we can distinguish the reports
const error1 = DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID; const error1 = DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID;
const error2 = DecryptionFailureCode.MEGOLM_BAD_ROOM; const error2 = DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE;
const error3 = DecryptionFailureCode.MEGOLM_MISSING_FIELDS; const error3 = DecryptionFailureCode.MEGOLM_KEY_WITHHELD;
// event that will be slow to decrypt // event that will be slow to decrypt
const lateDecryption = await createFailedDecryptionEvent({ code: error1 }); const lateDecryption = await createFailedDecryptionEvent({ code: error1 });
@@ -638,8 +638,8 @@ describe("DecryptionFailureTracker", function () {
// use three different errors so that we can distinguish the reports // use three different errors so that we can distinguish the reports
const error1 = DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID; const error1 = DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID;
const error2 = DecryptionFailureCode.MEGOLM_BAD_ROOM; const error2 = DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE;
const error3 = DecryptionFailureCode.MEGOLM_MISSING_FIELDS; const error3 = DecryptionFailureCode.MEGOLM_KEY_WITHHELD;
// event from a federated user (@alice:example.com) // event from a federated user (@alice:example.com)
const federatedDecryption = await createFailedDecryptionEvent({ const federatedDecryption = await createFailedDecryptionEvent({

View File

@@ -112,7 +112,6 @@ describe("<UserMenu>", () => {
it("should render 'Link new device' button in OIDC native mode", async () => { it("should render 'Link new device' button in OIDC native mode", async () => {
sdkContext.client = stubClient(); sdkContext.client = stubClient();
mocked(sdkContext.client.getAuthIssuer).mockResolvedValue({ issuer: "https://issuer/" });
const openIdMetadata = mockOpenIdConfiguration("https://issuer/"); const openIdMetadata = mockOpenIdConfiguration("https://issuer/");
openIdMetadata.grant_types_supported.push(DEVICE_CODE_SCOPE); openIdMetadata.grant_types_supported.push(DEVICE_CODE_SCOPE);
fetchMock.get("https://issuer/.well-known/openid-configuration", openIdMetadata); fetchMock.get("https://issuer/.well-known/openid-configuration", openIdMetadata);