Simplify isDeviceVerified
definitions (#10594)
* Simplify `isDeviceVerified` definitions Currently, we have two similar but different definitions of `isDeviceVerified`, and they both do a lot of wrangling that relies on js-sdk internals. We can simplify it a lot by just calling `MatrixClientPeg.checkDeviceTrust`. * fix tests * more test fixes
This commit is contained in:
parent
e4ebcf5731
commit
70b87f8bde
8 changed files with 37 additions and 67 deletions
|
@ -20,7 +20,7 @@ import userEvent from "@testing-library/user-event";
|
|||
import { mocked, Mocked } from "jest-mock";
|
||||
import { IMyDevice, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo";
|
||||
import { CrossSigningInfo } from "matrix-js-sdk/src/crypto/CrossSigning";
|
||||
import { DeviceTrustLevel } from "matrix-js-sdk/src/crypto/CrossSigning";
|
||||
|
||||
import dis from "../../src/dispatcher/dispatcher";
|
||||
import { showToast } from "../../src/toasts/UnverifiedSessionToast";
|
||||
|
@ -55,11 +55,7 @@ describe("UnverifiedSessionToast", () => {
|
|||
|
||||
return null;
|
||||
});
|
||||
client.getStoredCrossSigningForUser.mockReturnValue({
|
||||
checkDeviceTrust: jest.fn().mockReturnValue({
|
||||
isCrossSigningVerified: jest.fn().mockReturnValue(true),
|
||||
}),
|
||||
} as unknown as CrossSigningInfo);
|
||||
client.checkDeviceTrust.mockReturnValue(new DeviceTrustLevel(true, false, false, false));
|
||||
jest.spyOn(dis, "dispatch");
|
||||
jest.spyOn(DeviceListener.sharedInstance(), "dismissUnverifiedSessions");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue