Migrate batch of tests to vitest (#34108)

* Migrate utils/dm tests to vitest

* Migrate utils/room tests to vitest

* Migrate utils/location tests to vitest

* Fix types

* Satisfy tsc & knip
This commit is contained in:
Michael Telatynski
2026-07-03 08:50:11 +00:00
committed by GitHub
parent 8aba166f1e
commit df4a1f0c85
21 changed files with 209 additions and 166 deletions
@@ -7,6 +7,7 @@ Please see LICENSE files in the repository root for full details.
import type { MatrixClient, Room } from "matrix-js-sdk/src/matrix";
import { mkMessage, mkStubRoom } from "../../../../test-utils";
import { vi } from "../../../../setup/adapter.ts";
export function getMockedRooms(client: MatrixClient, roomCount: number = 100): Room[] {
const rooms: Room[] = [];
@@ -14,7 +15,7 @@ export function getMockedRooms(client: MatrixClient, roomCount: number = 100): R
const roomId = `!foo${i}:matrix.org`;
const room = mkStubRoom(roomId, `Foo Room ${i}`, client);
const event = mkMessage({ room: roomId, user: `@foo${i}:matrix.org`, ts: i + 1, event: true });
jest.spyOn(room.getLiveTimeline(), "getEvents").mockReturnValue([event]);
vi.spyOn(room.getLiveTimeline(), "getEvents").mockReturnValue([event]);
rooms.push(room);
}
return rooms;