@@ -60,6 +60,8 @@ import DMRoomMap from "../../../src/utils/DMRoomMap";
6060import  {  ReleaseAnnouncementStore  }  from  "../../../src/stores/ReleaseAnnouncementStore" ; 
6161import  {  DRAFT_LAST_CLEANUP_KEY  }  from  "../../../src/DraftCleaner" ; 
6262import  {  UIFeature  }  from  "../../../src/settings/UIFeature" ; 
63+ import  AutoDiscoveryUtils  from  "../../../src/utils/AutoDiscoveryUtils" ; 
64+ import  {  ValidatedServerConfig  }  from  "../../../src/utils/ValidatedServerConfig" ; 
6365
6466jest . mock ( "matrix-js-sdk/src/oidc/authorize" ,  ( )  =>  ( { 
6567    completeAuthorizationCodeGrant : jest . fn ( ) , 
@@ -213,23 +215,17 @@ describe("<MatrixChat />", () => {
213215    beforeEach ( async  ( )  =>  { 
214216        initPromise  =  undefined ; 
215217        mockClient  =  getMockClientWithEventEmitter ( getMockClientMethods ( ) ) ; 
216-         fetchMock . get ( "https://test.com/_matrix/client/versions" ,  { 
217-             unstable_features : { } , 
218-             versions : SERVER_SUPPORTED_MATRIX_VERSIONS , 
219-         } ) ; 
220-         fetchMock . catch ( { 
221-             status : 404 , 
222-             body : '{"errcode": "M_UNRECOGNIZED", "error": "Unrecognized request"}' , 
223-             headers : {  "content-type" : "application/json"  } , 
224-         } ) ; 
218+         jest . spyOn ( MatrixJs ,  "createClient" ) . mockReturnValue ( mockClient ) ; 
225219
226-         //jest.spyOn(StorageAccess, "idbLoad").mockReset(); 
227-         //jest.spyOn(StorageAccess, "idbSave").mockResolvedValue(undefined); 
228220        jest . spyOn ( defaultDispatcher ,  "dispatch" ) . mockClear ( ) ; 
229221        jest . spyOn ( defaultDispatcher ,  "fire" ) . mockClear ( ) ; 
230222
231223        DMRoomMap . makeShared ( mockClient ) ; 
232224
225+         jest . spyOn ( AutoDiscoveryUtils ,  "validateServerConfigWithStaticUrls" ) . mockResolvedValue ( 
226+             { }  as  ValidatedServerConfig , 
227+         ) ; 
228+ 
233229        await  clearAllModals ( ) ; 
234230    } ) ; 
235231
@@ -245,7 +241,6 @@ describe("<MatrixChat />", () => {
245241        DMRoomMap . setShared ( null ) ; 
246242
247243        jest . restoreAllMocks ( ) ; 
248-         fetchMock . mockReset ( ) ; 
249244
250245        // emit a loggedOut event so that all of the Store singletons forget about their references to the mock client 
251246        // (must be sync otherwise the next test will start before it happens) 
@@ -340,7 +335,6 @@ describe("<MatrixChat />", () => {
340335
341336        beforeEach ( ( )  =>  { 
342337            loginClient  =  getMockClientWithEventEmitter ( getMockClientMethods ( ) ) ; 
343-             ( loginClient  as  any ) . this_is_the_login_client  =  true ; 
344338            // this is used to create a temporary client during login 
345339            jest . spyOn ( MatrixJs ,  "createClient" ) . mockReturnValue ( loginClient ) ; 
346340
@@ -573,21 +567,12 @@ describe("<MatrixChat />", () => {
573567        it ( "should render welcome page after login" ,  async  ( )  =>  { 
574568            getComponent ( ) ; 
575569
576-             // we think we are logged in, but are still waiting for the /sync to complete 
577-             const  logoutButton  =  await  screen . findByText ( "Logout" ) ; 
578- 
579-             expect ( logoutButton ) . toBeInTheDocument ( ) ; 
580-             expect ( screen . getByRole ( "progressbar" ) ) . toBeInTheDocument ( ) ; 
581- 
582-             // initial sync 
583-             mockClient . emit ( ClientEvent . Sync ,  SyncState . Prepared ,  null ) ; 
584- 
585570            // wait for logged in view to load 
586571            await  screen . findByLabelText ( "User menu" ) ; 
587572
588573            expect ( screen . queryByRole ( "progressbar" ) ) . not . toBeInTheDocument ( ) ; 
589574            const  h1Element  =  screen . getByRole ( "heading" ,  {  level : 1  } ) ; 
590-             expect ( h1Element ) . toHaveTextContent ( `Welcome ${ userId }  ) ; 
575+             expect ( h1Element ) . toHaveTextContent ( `Welcome Ernie ` ) ; 
591576        } ) ; 
592577
593578        describe ( "clean up drafts" ,  ( )  =>  { 
0 commit comments