Remove redundant UserIdentityWarning test (#29403)

* Remove redundant `UserIdentityWarning` test

Since the refactoring in https://github.com/element-hq/element-web/pull/29067,
this test is redundant.

It is also flaky and hard to understand. Time for it to die.

* delint
This commit is contained in:
Richard van der Hoff 2025-03-03 15:28:46 +00:00 committed by GitHub
parent bf48100d31
commit 4b02520453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,7 @@ Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { sleep, defer } from "matrix-js-sdk/src/utils";
import { sleep } from "matrix-js-sdk/src/utils";
import {
EventType,
type MatrixClient,
@ -579,49 +579,4 @@ describe("UserIdentityWarning", () => {
expect(getWarningByText("@bob:example.org's identity appears to have changed.")).toBeInTheDocument(),
);
});
// If we get an update for a user's verification status while we're fetching
// that user's verification status, we should display based on the updated
// value.
describe("handles races between fetching verification status and receiving updates", () => {
// First case: check that if the update says that the user identity
// needs approval, but the fetch says it doesn't, we show the warning.
it("update says identity needs approval", async () => {
jest.spyOn(room, "getEncryptionTargetMembers").mockResolvedValue([
mockRoomMember("@alice:example.org", "Alice"),
]);
jest.spyOn(room, "getMember").mockReturnValue(mockRoomMember("@alice:example.org", "Alice"));
const crypto = client.getCrypto()!;
const firstStatusPromise = defer();
let callNumber = 0;
jest.spyOn(crypto, "getUserVerificationStatus").mockImplementation(async () => {
await firstStatusPromise.promise;
callNumber++;
if (callNumber == 1) {
await sleep(40);
return new UserVerificationStatus(false, false, false, false);
} else {
return new UserVerificationStatus(false, false, false, true);
}
});
renderComponent(client, room);
await sleep(10); // give it some time to finish initialising
act(() => {
client.emit(
CryptoEvent.UserTrustStatusChanged,
"@alice:example.org",
new UserVerificationStatus(false, false, false, true),
);
firstStatusPromise.resolve(undefined);
});
await waitFor(() =>
expect(
getWarningByText("Alice's (@alice:example.org) identity appears to have changed."),
).toBeInTheDocument(),
);
});
});
});