@@ -135,14 +135,17 @@ describe('loading:', function () {
135135
136136 const MatrixChat = sdk . getComponent ( 'structures.MatrixChat' ) ;
137137 const fragParts = parseQsFromFragment ( windowLocation ) ;
138+
139+ const config = Object . assign ( {
140+ default_hs_url : DEFAULT_HS_URL ,
141+ default_is_url : DEFAULT_IS_URL ,
142+ } , opts . config || { } ) ;
143+
138144 var params = parseQs ( windowLocation ) ;
139145 matrixChat = ReactDOM . render (
140146 < MatrixChat
141147 onNewScreen = { onNewScreen }
142- config = { {
143- default_hs_url : DEFAULT_HS_URL ,
144- default_is_url : DEFAULT_IS_URL ,
145- } }
148+ config = { config }
146149 realQueryParams = { params }
147150 startingFragmentQueryParams = { fragParts . params }
148151 enableGuest = { true }
@@ -343,6 +346,40 @@ describe('loading:', function () {
343346 } ) . done ( done , done ) ;
344347 } ) ;
345348
349+ it ( "registers correctly with a Riot Team Server" , function ( ) {
350+ sdk . setFetch ( httpBackend . fetchFn ) ; // XXX: ought to restore this!
351+
352+ httpBackend . when ( 'GET' , '/pushrules' ) . respond ( 200 , { } ) ;
353+ httpBackend . when ( 'POST' , '/filter' ) . respond ( 200 , { filter_id : 'fid' } ) ;
354+
355+ loadApp ( {
356+ config : {
357+ teamServerConfig : {
358+ teamServerURL : 'http://my_team_server' ,
359+ } ,
360+ } ,
361+ } ) ;
362+
363+ return q . delay ( 1 ) . then ( ( ) => {
364+ // we expect a loading spinner while we log into the RTS
365+ assertAtLoadingSpinner ( matrixChat ) ;
366+
367+ httpBackend . when ( 'GET' , 'my_team_server/login' ) . respond ( 200 , {
368+ team_token : 'nom' ,
369+ } ) ;
370+ return httpBackend . flush ( ) ;
371+ } ) . then ( ( ) => {
372+ return awaitSyncingSpinner ( matrixChat )
373+ } ) . then ( ( ) => {
374+ // we got a sync spinner - let the sync complete
375+ return expectAndAwaitSync ( ) ;
376+ } ) . then ( ( ) => {
377+ // once the sync completes, we should have a home page
378+ ReactTestUtils . findRenderedComponentWithType (
379+ matrixChat , sdk . getComponent ( 'structures.HomePage' ) ) ;
380+ } ) ;
381+ } ) ;
382+
346383 describe ( '/#/login link:' , function ( ) {
347384 beforeEach ( function ( ) {
348385 loadApp ( {
0 commit comments