You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-09 08:42:50 +03:00
Fix jest/valid-expects lints (#11238)
This commit is contained in:
committed by
GitHub
parent
d7d60a3255
commit
f5f31eb7d8
@@ -509,18 +509,23 @@ describe("<DeviceItem />", () => {
|
||||
});
|
||||
|
||||
it("when userId is the same as userId from client, uses isCrossSigningVerified to determine if button is shown", async () => {
|
||||
const deferred = defer<DeviceVerificationStatus>();
|
||||
mockCrypto.getDeviceVerificationStatus.mockReturnValue(deferred.promise);
|
||||
|
||||
mockClient.getSafeUserId.mockReturnValueOnce(defaultUserId);
|
||||
mockClient.getUserId.mockReturnValueOnce(defaultUserId);
|
||||
renderComponent();
|
||||
await act(flushPromises);
|
||||
|
||||
// set trust to be false for isVerified, true for isCrossSigningVerified
|
||||
setMockDeviceTrust(false, true);
|
||||
deferred.resolve({
|
||||
isVerified: () => false,
|
||||
crossSigningVerified: true,
|
||||
} as DeviceVerificationStatus);
|
||||
|
||||
await expect(screen.findByText(device.displayName!)).resolves.toBeInTheDocument();
|
||||
// expect to see no button in this case
|
||||
// TODO `toBeInTheDocument` is not called, if called the test is failing
|
||||
expect(screen.queryByRole("button")).not.toBeInTheDocument;
|
||||
expect(screen.getByText(device.displayName!)).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("with verified user and device, displays no button and a 'Trusted' label", async () => {
|
||||
|
Reference in New Issue
Block a user