Fix tsc issues in right_panel and room component tests (#8078)

* fix ts issues in SendMessageComposer-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove empty file

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix tsc issues in MessageComposerbUttons-test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix the rest

Signed-off-by: Kerry Archibald <kerrya@element.io>

* bad autoformatter

Signed-off-by: Kerry Archibald <kerrya@element.io>

* tsc fixes for test/components/views/right_panel

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry
2022-03-21 10:03:03 +01:00
committed by GitHub
parent d7a3f39a3e
commit 026ca1ab64
9 changed files with 125 additions and 88 deletions
@@ -28,13 +28,14 @@ import * as TestUtils from '../../../test-utils';
import { compare } from "../../../../src/utils/strings";
import MemberList from "../../../../src/components/views/rooms/MemberList";
import MemberTile from '../../../../src/components/views/rooms/MemberTile';
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
function generateRoomId() {
return '!' + Math.random().toString().slice(2, 10) + ':domain';
}
describe('MemberList', () => {
function createRoom(opts) {
function createRoom(opts = {}) {
const room = new Room(generateRoomId(), null, client.getUserId());
if (opts) {
Object.assign(room, opts);
@@ -114,16 +115,20 @@ describe('MemberList', () => {
memberListRoom.currentState.members[member.userId] = member;
}
const WrappedMemberList = TestUtils.wrapInMatrixClientContext(MemberList);
const gatherWrappedRef = (r) => {
memberList = r;
};
root = ReactDOM.render(
(
<WrappedMemberList
roomId={memberListRoom.roomId}
wrappedRef={gatherWrappedRef}
/>
<MatrixClientContext.Provider value={client}>
<MemberList
searchQuery=""
onClose={jest.fn()}
onSearchQueryChanged={jest.fn()}
roomId={memberListRoom.roomId}
ref={gatherWrappedRef}
/>
</MatrixClientContext.Provider>
),
parentDiv,
);