@@ -7,7 +7,14 @@ Please see LICENSE files in the repository root for full details.
77*/
88
99import React from "react" ;
10- import { EventType , type MatrixEvent , RoomMember , THREAD_RELATION_TYPE } from "matrix-js-sdk/src/matrix" ;
10+ import {
11+ EventType ,
12+ type MatrixClient ,
13+ type MatrixEvent ,
14+ Room ,
15+ RoomMember ,
16+ THREAD_RELATION_TYPE ,
17+ } from "matrix-js-sdk/src/matrix" ;
1118import { act , fireEvent , render , screen , waitFor } from "jest-matrix-react" ;
1219import userEvent from "@testing-library/user-event" ;
1320import { initOnce } from "@vector-im/matrix-wysiwyg" ;
@@ -56,10 +63,12 @@ const expectVoiceMessageRecordingTriggered = (): void => {
5663beforeAll ( initOnce , 10000 ) ;
5764
5865describe ( "MessageComposer" , ( ) => {
59- stubClient ( ) ;
60- const cli = createTestClient ( ) ;
66+ let cli : MatrixClient ;
6167
6268 beforeEach ( ( ) => {
69+ stubClient ( ) ;
70+ cli = createTestClient ( ) ;
71+
6372 mockPlatformPeg ( ) ;
6473 } ) ;
6574
@@ -121,7 +130,11 @@ describe("MessageComposer", () => {
121130 } , 10000 ) ;
122131
123132 describe ( "for a Room" , ( ) => {
124- const room = mkStubRoom ( "!roomId:server" , "Room 1" , cli ) ;
133+ let room : Room ;
134+
135+ beforeEach ( ( ) => {
136+ room = mkStubRoom ( "!roomId:server" , "Room 1" , cli ) ;
137+ } ) ;
125138
126139 it ( "Renders a SendMessageComposer and MessageComposerButtons by default" , ( ) => {
127140 wrapAndRender ( { room } ) ;
@@ -424,7 +437,11 @@ describe("MessageComposer", () => {
424437 } ) ;
425438
426439 describe ( "for a LocalRoom" , ( ) => {
427- const localRoom = new LocalRoom ( "!room:example.com" , cli , cli . getUserId ( ) ! ) ;
440+ let localRoom : LocalRoom ;
441+
442+ beforeEach ( ( ) => {
443+ localRoom = new LocalRoom ( "!room:example.com" , cli , cli . getUserId ( ) ! ) ;
444+ } ) ;
428445
429446 it ( "should not show the stickers button" , async ( ) => {
430447 wrapAndRender ( { room : localRoom } ) ;
0 commit comments