Disable upgraderoom command without developer mode enabled (#11744)
* Disable upgraderoom command without developer mode enabled Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
bdf2ebd301
commit
255f0f59f5
2 changed files with 18 additions and 2 deletions
|
@ -28,6 +28,7 @@ import WidgetUtils from "../src/utils/WidgetUtils";
|
|||
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";
|
||||
|
||||
jest.mock("../src/components/views/right_panel/UserInfo");
|
||||
|
||||
|
@ -88,7 +89,6 @@ describe("SlashCommands", () => {
|
|||
});
|
||||
|
||||
describe.each([
|
||||
["upgraderoom"],
|
||||
["myroomnick"],
|
||||
["roomavatar"],
|
||||
["myroomavatar"],
|
||||
|
@ -126,6 +126,22 @@ describe("SlashCommands", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("/upgraderoom", () => {
|
||||
beforeEach(() => {
|
||||
command = findCommand("upgraderoom")!;
|
||||
setCurrentRoom();
|
||||
});
|
||||
|
||||
it("should be disabled by default", () => {
|
||||
expect(command.isEnabled(client)).toBe(false);
|
||||
});
|
||||
|
||||
it("should be enabled for developerMode", () => {
|
||||
SettingsStore.setValue("developerMode", null, SettingLevel.DEVICE, true);
|
||||
expect(command.isEnabled(client)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("/op", () => {
|
||||
beforeEach(() => {
|
||||
command = findCommand("op")!;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue