First batch: remove deprecated calls on MatrixClient (#28207)
* Remove `initCrypto` mocking * Remove `MatrixClient.downloadKeys` mocking * Remove `MatrixClient.getStoredDevice` mocking * Replace `MatrixClient.setGlobalBlacklistUnverifiedDevices` by `MatrixClient.CryptoApi.globalBlacklistUnverifiedDevices` * Remove `MatrixClient.getStoredCrossSigningForUser` mocking * Replace `MatrixClient.legacyDeviceVerification` by `MatrixClient.CryptoApi.requestDeviceVerification` * Remove `MatrixClient.isCrossSigningReady` mock * Replace `MatrixClient.bootstrapCrossSigning` by `MatrixClient.getCrypto.bootstrapCrossSigning` * Replace `MatrixClient.getCryptoTrustCrossSignedDevices` by `MatrixClient.getCrypto.getTrustCrossSignedDevices` * Replace `MatrixClient.hasSecretStorageKey` by `MatrixClient.SecretStorage.hasKey` * Replace `MatrixClient.getDefaultSecretStorageKeyId` by `MatrixClient.SecretStorage.getDefaultKeyId` * Remove `MatrixClient.encryptAndSendToDevices` call
This commit is contained in:
@@ -141,10 +141,8 @@ export const mockClientMethodsDevice = (
|
||||
export const mockClientMethodsCrypto = (): Partial<
|
||||
Record<MethodLikeKeys<MatrixClient> & PropertyLikeKeys<MatrixClient>, unknown>
|
||||
> => ({
|
||||
isCrossSigningReady: jest.fn(),
|
||||
isKeyBackupKeyStored: jest.fn(),
|
||||
getCrossSigningCacheCallbacks: jest.fn().mockReturnValue({ getCrossSigningKeyCache: jest.fn() }),
|
||||
getStoredCrossSigningForUser: jest.fn(),
|
||||
getKeyBackupVersion: jest.fn().mockResolvedValue(null),
|
||||
secretStorage: { hasKey: jest.fn() },
|
||||
getCrypto: jest.fn().mockReturnValue({
|
||||
|
||||
@@ -95,20 +95,17 @@ export function createTestClient(): MatrixClient {
|
||||
getUser: jest.fn().mockReturnValue({ on: jest.fn(), off: jest.fn() }),
|
||||
getDevice: jest.fn(),
|
||||
getDeviceId: jest.fn().mockReturnValue("ABCDEFGHI"),
|
||||
getStoredCrossSigningForUser: jest.fn(),
|
||||
getStoredDevice: jest.fn(),
|
||||
deviceId: "ABCDEFGHI",
|
||||
getDevices: jest.fn().mockResolvedValue({ devices: [{ device_id: "ABCDEFGHI" }] }),
|
||||
getSessionId: jest.fn().mockReturnValue("iaszphgvfku"),
|
||||
credentials: { userId: "@userId:matrix.org" },
|
||||
bootstrapCrossSigning: jest.fn(),
|
||||
hasSecretStorageKey: jest.fn(),
|
||||
getKeyBackupVersion: jest.fn(),
|
||||
|
||||
secretStorage: {
|
||||
get: jest.fn(),
|
||||
isStored: jest.fn().mockReturnValue(false),
|
||||
checkKey: jest.fn().mockResolvedValue(false),
|
||||
hasKey: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
|
||||
store: {
|
||||
@@ -208,12 +205,10 @@ export function createTestClient(): MatrixClient {
|
||||
}),
|
||||
hasLazyLoadMembersEnabled: jest.fn().mockReturnValue(false),
|
||||
isInitialSyncComplete: jest.fn().mockReturnValue(true),
|
||||
downloadKeys: jest.fn(),
|
||||
fetchRoomEvent: jest.fn().mockRejectedValue({}),
|
||||
makeTxnId: jest.fn().mockImplementation(() => `t${txnId++}`),
|
||||
sendToDevice: jest.fn().mockResolvedValue(undefined),
|
||||
queueToDevice: jest.fn().mockResolvedValue(undefined),
|
||||
encryptAndSendToDevices: jest.fn().mockResolvedValue(undefined),
|
||||
cancelPendingEvent: jest.fn(),
|
||||
|
||||
getMediaHandler: jest.fn().mockReturnValue({
|
||||
|
||||
Reference in New Issue
Block a user