@@ -53,26 +53,29 @@ describe("NewRoomIntro", () => {
5353 describe ( "for a DM Room" , ( ) => {
5454 beforeEach ( ( ) => {
5555 jest . spyOn ( DMRoomMap . shared ( ) , "getUserIdForRoomId" ) . mockReturnValue ( userId ) ;
56- renderNewRoomIntro ( client , new Room ( roomId , client , client . getUserId ( ) ) ) ;
56+ const room = new Room ( roomId , client , client . getUserId ( ) ) ;
57+ room . name = "test_room" ;
58+ renderNewRoomIntro ( client , room ) ;
5759 } ) ;
5860
5961 it ( "should render the expected intro" , ( ) => {
60- const expected = `This is the beginning of your direct message history with ${ userId } .` ;
61- screen . getByText ( ( id , element ) => element . tagName === "SPAN" && element . textContent === expected ) ;
62+ const expected = `This is the beginning of your direct message history with test_room .` ;
63+ screen . getByText ( ( id , element ) => element ? .tagName === "SPAN" && element ? .textContent === expected ) ;
6264 } ) ;
6365 } ) ;
6466
6567 describe ( "for a DM LocalRoom" , ( ) => {
6668 beforeEach ( ( ) => {
6769 jest . spyOn ( DMRoomMap . shared ( ) , "getUserIdForRoomId" ) . mockReturnValue ( userId ) ;
6870 const localRoom = new LocalRoom ( roomId , client , client . getUserId ( ) ) ;
71+ localRoom . name = "test_room" ;
6972 localRoom . targets . push ( new DirectoryMember ( { user_id : userId } ) ) ;
7073 renderNewRoomIntro ( client , localRoom ) ;
7174 } ) ;
7275
7376 it ( "should render the expected intro" , ( ) => {
74- const expected = `Send your first message to invite ${ userId } to chat` ;
75- screen . getByText ( ( id , element ) => element . tagName === "SPAN" && element . textContent === expected ) ;
77+ const expected = `Send your first message to invite test_room to chat` ;
78+ screen . getByText ( ( id , element ) => element ? .tagName === "SPAN" && element ? .textContent === expected ) ;
7679 } ) ;
7780 } ) ;
7881} ) ;
0 commit comments