include /test/stores in tsconfig (#8026)
* fix space store emits Signed-off-by: Kerry Archibald <kerrya@element.io> * fix spacestore-test imports * fix export-test.tsx Signed-off-by: Kerry Archibald <kerrya@element.io> * include test/utils to tsconfig Signed-off-by: Kerry Archibald <kerrya@element.io> * fix types in SpaceStore-test Signed-off-by: Kerry Archibald <kerrya@element.io> * fix ts issues in rest of test/stores Signed-off-by: Kerry Archibald <kerrya@element.io> * include test/stores in tsconfig Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
ceb2281d36
commit
df6c53ff41
7 changed files with 83 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
|||
import EventEmitter from "events";
|
||||
import { mocked } from 'jest-mock';
|
||||
import { mocked, MockedObject } from 'jest-mock';
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { JoinRule } from 'matrix-js-sdk/src/@types/partials';
|
||||
import {
|
||||
|
@ -417,8 +417,12 @@ export const mockStateEventImplementation = (events: MatrixEvent[]) => {
|
|||
return getStateEvents;
|
||||
};
|
||||
|
||||
export const mkRoom = (client: MatrixClient, roomId: string, rooms?: ReturnType<typeof mkStubRoom>[]) => {
|
||||
const room = mkStubRoom(roomId, roomId, client);
|
||||
export const mkRoom = (
|
||||
client: MatrixClient,
|
||||
roomId: string,
|
||||
rooms?: ReturnType<typeof mkStubRoom>[],
|
||||
): MockedObject<Room> => {
|
||||
const room = mocked(mkStubRoom(roomId, roomId, client));
|
||||
mocked(room.currentState).getStateEvents.mockImplementation(mockStateEventImplementation([]));
|
||||
rooms?.push(room);
|
||||
return room;
|
||||
|
@ -447,9 +451,9 @@ export const mkSpace = (
|
|||
spaceId: string,
|
||||
rooms?: ReturnType<typeof mkStubRoom>[],
|
||||
children: string[] = [],
|
||||
) => {
|
||||
const space = mkRoom(client, spaceId, rooms);
|
||||
mocked(space).isSpaceRoom.mockReturnValue(true);
|
||||
): MockedObject<Room> => {
|
||||
const space = mocked(mkRoom(client, spaceId, rooms));
|
||||
space.isSpaceRoom.mockReturnValue(true);
|
||||
mocked(space.currentState).getStateEvents.mockImplementation(mockStateEventImplementation(children.map(roomId =>
|
||||
mkEvent({
|
||||
event: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue