Provide a devtool for manually verifying other devices (#30094)

Also allows doing the same thing via a slash command.
This commit is contained in:
Andy Balaam
2025-06-10 10:55:05 +00:00
committed by GitHub
parent a333856c50
commit e7d940160a
8 changed files with 572 additions and 0 deletions
+15
View File
@@ -21,6 +21,7 @@ import { WidgetType } from "../../src/widgets/WidgetType";
import { warnSelfDemote } from "../../src/components/views/right_panel/UserInfo";
import dispatcher from "../../src/dispatcher/dispatcher";
import { SettingLevel } from "../../src/settings/SettingLevel";
import ErrorDialog from "../../src/components/views/dialogs/ErrorDialog";
jest.mock("../../src/components/views/right_panel/UserInfo");
@@ -253,6 +254,20 @@ describe("SlashCommands", () => {
});
});
describe("/verify", () => {
it("should return usage if no args", () => {
const command = findCommand("verify")!;
expect(command.run(client, roomId, null, undefined).error).toBe(command.getUsage());
});
it("should show an error if device is not found", async () => {
const spy = jest.spyOn(Modal, "createDialog");
const command = findCommand("verify")!;
await command.run(client, roomId, null, "mydeviceid myfingerprint").promise;
expect(spy).toHaveBeenCalledWith(ErrorDialog, expect.objectContaining({ title: "Verification failed" }));
});
});
describe("/addwidget", () => {
it("should parse html iframe snippets", async () => {
jest.spyOn(WidgetUtils, "canUserModifyWidgets").mockReturnValue(true);