Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ff15249

Browse files
authored
Make widget tests throw when a modal is shown (#12834)
Instead of waiting for tests to time out if they show a dialog that they cannot interact with, throw an error immediately if a dialog is shown.
1 parent 11cc174 commit ff15249

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/stores/widgets/StopGapWidgetDriver-test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { StopGapWidgetDriver } from "../../../src/stores/widgets/StopGapWidgetDr
4949
import { stubClient } from "../../test-utils";
5050
import { ModuleRunner } from "../../../src/modules/ModuleRunner";
5151
import dis from "../../../src/dispatcher/dispatcher";
52+
import Modal from "../../../src/Modal";
5253
import SettingsStore from "../../../src/settings/SettingsStore";
5354

5455
describe("StopGapWidgetDriver", () => {
@@ -68,6 +69,10 @@ describe("StopGapWidgetDriver", () => {
6869
"!1:example.org",
6970
);
7071

72+
jest.spyOn(Modal, "createDialog").mockImplementation(() => {
73+
throw new Error("Should not have to create a dialog");
74+
});
75+
7176
beforeEach(() => {
7277
stubClient();
7378
client = mocked(MatrixClientPeg.safeGet());
@@ -127,7 +132,6 @@ describe("StopGapWidgetDriver", () => {
127132
"org.matrix.msc4157.update_delayed_event",
128133
]);
129134

130-
// As long as this resolves, we'll know that it didn't try to pop up a modal
131135
const approvedCapabilities = await driver.validateCapabilities(requestedCapabilities);
132136
expect(approvedCapabilities).toEqual(requestedCapabilities);
133137
});

0 commit comments

Comments
 (0)