1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-31 13:44:28 +03:00

Only display bulk unverified sessions nag when current session is verified (PSG-893) (#9656)

* test bulk unverified sessions toast behaviour

* unverified sessions toast text tweak

* only show bulk unverified sessions toast when current device is verified

* add more assertions for show/hide toast, fix strict errors

* fix strict error

* really fix strict error
This commit is contained in:
Kerry
2022-12-02 15:59:46 +13:00
committed by GitHub
parent 8996bf0a7f
commit 5742c24114
4 changed files with 18 additions and 9 deletions

View File

@ -414,11 +414,16 @@ describe('DeviceListener', () => {
expect(BulkUnverifiedSessionsToast.showToast).not.toHaveBeenCalled();
});
it('hides toast when only unverified device is the current device', async () => {
mockClient!.getStoredDevicesForUser.mockReturnValue([
currentDevice,
]);
mockClient!.checkDeviceTrust.mockReturnValue(deviceTrustUnverified);
it('hides toast when current device is unverified', async () => {
// device2 verified, current and device3 unverified
mockClient!.checkDeviceTrust.mockImplementation((_userId, deviceId) => {
switch (deviceId) {
case device2.deviceId:
return deviceTrustVerified;
default:
return deviceTrustUnverified;
}
});
await createAndStart();
expect(BulkUnverifiedSessionsToast.hideToast).toHaveBeenCalled();
expect(BulkUnverifiedSessionsToast.showToast).not.toHaveBeenCalled();