1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-06 10:22:45 +03:00

Device manager - promote to beta (#9380)

* promote new session manager to beta

* hide old sessions section when new dm enabled

* use correct logic

* add new ViewUserDeviceSettings action

* replace device management ctas with viewUserDeviceSettings

* test SecurityUserSettingsTab

* more complete mocks

* more thorough mocks

* more mocks

* test LabsUserSettingsTab

* lint

* updated copy

* update snaps for new copy
This commit is contained in:
Kerry
2022-10-11 11:10:55 +02:00
committed by GitHub
parent b336e18eae
commit 87d3fbd996
15 changed files with 504 additions and 19 deletions

View File

@@ -15,7 +15,7 @@ limitations under the License.
*/
import EventEmitter from "events";
import { MethodKeysOf, mocked, MockedObject } from "jest-mock";
import { MethodKeysOf, mocked, MockedObject, PropertyKeysOf } from "jest-mock";
import { MatrixClient, User } from "matrix-js-sdk/src/matrix";
import { MatrixClientPeg } from "../../src/MatrixClientPeg";
@@ -71,6 +71,7 @@ export const mockClientMethodsUser = (userId = '@alice:domain') => ({
credentials: { userId },
getThreePids: jest.fn().mockResolvedValue({ threepids: [] }),
getAccessToken: jest.fn(),
getDeviceId: jest.fn(),
});
/**
@@ -94,6 +95,35 @@ export const mockClientMethodsServer = (): Partial<Record<MethodKeysOf<MatrixCli
getIdentityServerUrl: jest.fn(),
getHomeserverUrl: jest.fn(),
getCapabilities: jest.fn().mockReturnValue({}),
getClientWellKnown: jest.fn().mockReturnValue({}),
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
});
export const mockClientMethodsDevice = (
deviceId = 'test-device-id',
): Partial<Record<MethodKeysOf<MatrixClient>, unknown>> => ({
getDeviceId: jest.fn().mockReturnValue(deviceId),
getDeviceEd25519Key: jest.fn(),
getDevices: jest.fn().mockResolvedValue({ devices: [] }),
});
export const mockClientMethodsCrypto = (): Partial<Record<
MethodKeysOf<MatrixClient> & PropertyKeysOf<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({}),
crypto: {
getSessionBackupPrivateKey: jest.fn(),
secretStorage: { hasKey: jest.fn() },
crossSigningInfo: {
getId: jest.fn(),
isStoredInSecretStorage: jest.fn(),
},
},
});