Skip to content

Commit a432c61

Browse files
committed
more review
1 parent edc8c33 commit a432c61

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/ClientWidgetApi-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ describe("ClientWidgetApi", () => {
14371437
describe("org.matrix.msc2876.read_events action", () => {
14381438
it("reads events from a specific room", async () => {
14391439
const roomId = "!room:example.org";
1440-
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockReturnValue(new Promise((r) => r([])));
1440+
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockResolvedValue([]);
14411441
const event = createRoomEvent({ room_id: roomId, type: "net.example.test", content: "test" });
14421442
driver.readRoomTimeline.mockImplementation(async (rId) => {
14431443
if (rId === roomId) return [event];
@@ -1536,7 +1536,7 @@ describe("ClientWidgetApi", () => {
15361536
});
15371537

15381538
it("reads state events with any state key", async () => {
1539-
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockReturnValue(new Promise((r) => r([])));
1539+
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockResolvedValue([]);
15401540
driver.readRoomState.mockResolvedValue([
15411541
createRoomEvent({ type: "net.example.test", state_key: "A" }),
15421542
createRoomEvent({ type: "net.example.test", state_key: "B" }),
@@ -1596,7 +1596,7 @@ describe("ClientWidgetApi", () => {
15961596
});
15971597

15981598
it("reads state events with a specific state key", async () => {
1599-
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockReturnValue(new Promise((r) => r([])));
1599+
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockResolvedValue([]);
16001600
driver.readRoomState.mockResolvedValue([createRoomEvent({ type: "net.example.test", state_key: "B" })]);
16011601

16021602
const event: IReadEventFromWidgetActionRequest = {
@@ -1625,7 +1625,7 @@ describe("ClientWidgetApi", () => {
16251625
});
16261626

16271627
it("reads state events with a specific state key from the timeline when using UnstableApiVersion.MSC2762_UPDATE_STATE", async () => {
1628-
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockReturnValue(new Promise((r) => r(CurrentApiVersions)));
1628+
jest.spyOn(clientWidgetApi, "getWidgetVersions").mockResolvedValue(CurrentApiVersions);
16291629
// with version MSC2762_UPDATE_STATE we wan the read Events action to read state events from the timeline.
16301630
driver.readRoomTimeline.mockResolvedValue([createRoomEvent({ type: "net.example.test", state_key: "B" })]);
16311631

0 commit comments

Comments
 (0)