@@ -30,9 +30,10 @@ const archiveSite = jest.fn();
3030jest . mock ( '../../hooks/use-archive-site' ) ;
3131
3232const mockShowMessageBox = jest . fn ( ) ;
33+ const mockOpenURL = jest . fn ( ) ;
3334jest . mock ( '../../lib/get-ipc-api' , ( ) => ( {
3435 getIpcApi : ( ) => ( {
35- openURL : jest . fn ( ) ,
36+ openURL : mockOpenURL ,
3637 generateProposedSitePath : jest . fn ( ) ,
3738 showMessageBox : mockShowMessageBox ,
3839 } ) ,
@@ -432,6 +433,30 @@ describe( 'ContentTabSnapshots', () => {
432433 expect ( clearSnapshotsButton ) . not . toBeInTheDocument ( ) ;
433434 } ) ;
434435 } ) ;
436+
437+ test ( 'clicking the demo site URL opens the browser' , async ( ) => {
438+ const user = userEvent . setup ( ) ;
439+ ( useSnapshots as jest . Mock ) . mockReturnValue ( {
440+ snapshots : [
441+ {
442+ url : 'fake-site.fake' ,
443+ atomicSiteId : 150 ,
444+ localSiteId : 'site-id-1' ,
445+ date : new Date ( ) . getTime ( ) ,
446+ deleted : false ,
447+ } ,
448+ ] ,
449+ fetchSnapshotUsage : jest . fn ( ) ,
450+ } ) ;
451+
452+ render ( < ContentTabSnapshots selectedSite = { selectedSite } /> ) ;
453+
454+ const urlButton = screen . getByRole ( 'button' , { name : 'https://fake-site.fake ↗' } ) ;
455+ expect ( urlButton ) . toBeVisible ( ) ;
456+ await user . click ( urlButton ) ;
457+
458+ expect ( mockOpenURL ) . toHaveBeenCalledWith ( 'https://fake-site.fake' ) ;
459+ } ) ;
435460} ) ;
436461
437462describe ( 'AddDemoSiteWithProgress' , ( ) => {
0 commit comments