@@ -145,12 +145,14 @@ describe("MatrixClient", function() {
145145 describe ( "joinRoom" , function ( ) {
146146 it ( "should no-op if you've already joined a room" , function ( ) {
147147 const roomId = "!foo:bar" ;
148- const room = new Room ( roomId , userId ) ;
148+ const room = new Room ( roomId , client , userId ) ;
149+ client . fetchRoomEvent = ( ) => Promise . resolve ( { } ) ;
149150 room . addLiveEvents ( [
150151 utils . mkMembership ( {
151152 user : userId , room : roomId , mship : "join" , event : true ,
152153 } ) ,
153154 ] ) ;
155+ httpBackend . verifyNoOutstandingRequests ( ) ;
154156 store . storeRoom ( room ) ;
155157 client . joinRoom ( roomId ) ;
156158 httpBackend . verifyNoOutstandingRequests ( ) ;
@@ -556,11 +558,14 @@ describe("MatrixClient", function() {
556558 } ) ;
557559
558560 describe ( "partitionThreadedEvents" , function ( ) {
559- const room = new Room ( "!STrMRsukXHtqQdSeHa:matrix.org" , client , userId ) ;
561+ let room ;
562+ beforeEach ( ( ) => {
563+ room = new Room ( "!STrMRsukXHtqQdSeHa:matrix.org" , client , userId ) ;
564+ } ) ;
560565
561566 it ( "returns empty arrays when given an empty arrays" , function ( ) {
562567 const events = [ ] ;
563- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
568+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
564569 expect ( timeline ) . toEqual ( [ ] ) ;
565570 expect ( threaded ) . toEqual ( [ ] ) ;
566571 } ) ;
@@ -580,7 +585,7 @@ describe("MatrixClient", function() {
580585 // Vote has no threadId yet
581586 expect ( eventPollResponseReference . threadId ) . toBeFalsy ( ) ;
582587
583- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
588+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
584589
585590 expect ( timeline ) . toEqual ( [
586591 // The message that was sent in a thread is missing
@@ -613,7 +618,7 @@ describe("MatrixClient", function() {
613618 eventReaction ,
614619 ] ;
615620
616- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
621+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
617622
618623 expect ( timeline ) . toEqual ( [
619624 eventPollStartThreadRoot ,
@@ -640,7 +645,7 @@ describe("MatrixClient", function() {
640645 eventMessageInThread ,
641646 ] ;
642647
643- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
648+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
644649
645650 expect ( timeline ) . toEqual ( [
646651 eventPollStartThreadRoot ,
@@ -667,7 +672,7 @@ describe("MatrixClient", function() {
667672 eventReaction ,
668673 ] ;
669674
670- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
675+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
671676
672677 expect ( timeline ) . toEqual ( [
673678 eventPollStartThreadRoot ,
@@ -710,7 +715,7 @@ describe("MatrixClient", function() {
710715 eventMember ,
711716 eventCreate ,
712717 ] ;
713- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
718+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
714719
715720 expect ( timeline ) . toEqual ( [
716721 // The message that was sent in a thread is missing
@@ -749,7 +754,7 @@ describe("MatrixClient", function() {
749754 threadedReactionRedaction ,
750755 ] ;
751756
752- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
757+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
753758
754759 expect ( timeline ) . toEqual ( [
755760 threadRootEvent ,
@@ -778,7 +783,7 @@ describe("MatrixClient", function() {
778783 replyToReply ,
779784 ] ;
780785
781- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
786+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
782787
783788 expect ( timeline ) . toEqual ( [
784789 threadRootEvent ,
@@ -805,7 +810,7 @@ describe("MatrixClient", function() {
805810 replyToThreadResponse ,
806811 ] ;
807812
808- const [ timeline , threaded ] = client . partitionThreadedEvents ( room , events ) ;
813+ const [ timeline , threaded ] = room . partitionThreadedEvents ( events ) ;
809814
810815 expect ( timeline ) . toEqual ( [
811816 threadRootEvent ,
0 commit comments