Settings panels: avoid exceptions with rust crypto (#10962)
* Settings panels: avoid exceptions with rust crypto If we are using rust crypto, `client.crypto` is undefined. We'll need to fix these up better in future, but for now, just return early. * Update tests
This commit is contained in:
parent
7c34d66bde
commit
161e19dfb6
5 changed files with 20 additions and 14 deletions
|
@ -66,7 +66,7 @@ export class MockClientWithEventEmitter extends EventEmitter {
|
|||
* ```
|
||||
*/
|
||||
export const getMockClientWithEventEmitter = (
|
||||
mockProperties: Partial<Record<MethodLikeKeys<MatrixClient>, unknown>>,
|
||||
mockProperties: Partial<Record<keyof MatrixClient, unknown>>,
|
||||
): MockedObject<MatrixClient> => {
|
||||
const mock = mocked(new MockClientWithEventEmitter(mockProperties) as unknown as MatrixClient);
|
||||
|
||||
|
@ -143,15 +143,15 @@ export const mockClientMethodsCrypto = (): Partial<
|
|||
Record<MethodLikeKeys<MatrixClient> & PropertyLikeKeys<MatrixClient>, unknown>
|
||||
> => ({
|
||||
isCryptoEnabled: jest.fn(),
|
||||
isSecretStorageReady: jest.fn(),
|
||||
isCrossSigningReady: jest.fn(),
|
||||
isKeyBackupKeyStored: jest.fn(),
|
||||
getCrossSigningCacheCallbacks: jest.fn().mockReturnValue({ getCrossSigningKeyCache: jest.fn() }),
|
||||
getStoredCrossSigningForUser: jest.fn(),
|
||||
checkKeyBackup: jest.fn().mockReturnValue({}),
|
||||
secretStorage: { hasKey: jest.fn() },
|
||||
crypto: {
|
||||
isSecretStorageReady: jest.fn(),
|
||||
getSessionBackupPrivateKey: jest.fn(),
|
||||
secretStorage: { hasKey: jest.fn() },
|
||||
crossSigningInfo: {
|
||||
getId: jest.fn(),
|
||||
isStoredInSecretStorage: jest.fn(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue