Provide a devtool for manually verifying other devices (#30094)
Also allows doing the same thing via a slash command.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user