@@ -708,7 +708,7 @@ describe('Test App Store', () => {
708708 expect ( openPageArgs [ 0 ] ) . to . include ( liveHost ) ;
709709 } ) ;
710710
711- it ( 'switches from preview to BYOM editor' , async ( ) => {
711+ it ( 'switches from preview to BYOM editor, no edit URL ' , async ( ) => {
712712 instance . siteStore . contentSourceUrl = 'https://aemcloud.com' ;
713713 instance . siteStore . contentSourceEditLabel = 'Universal Editor' ;
714714 instance . siteStore . contentSourceEditPattern = '{{contentSourceUrl}}{{pathname}}?cmd=open' ;
@@ -722,6 +722,23 @@ describe('Test App Store', () => {
722722 expect ( loadPage . calledWith ( 'https://aemcloud.com/index?cmd=open' ) ) . to . be . true ;
723723 } ) ;
724724
725+ it ( 'switches from preview to BYOM editor, overwrites edit URL ' , async ( ) => {
726+ instance . siteStore . contentSourceUrl = 'https://aemcloud.com' ;
727+ instance . siteStore . contentSourceEditLabel = 'Universal Editor' ;
728+ instance . siteStore . contentSourceEditPattern = '{{contentSourceUrl}}{{pathname}}?cmd=open' ;
729+
730+ const fetchStatusStub = sidekickTest . sandbox . stub ( instance , 'fetchStatus' ) ;
731+ fetchStatusStub . onCall ( 0 ) . resolves ( {
732+ webPath : '/' ,
733+ edit : { url : 'https://edit.example.com/original-path' } ,
734+ } ) ;
735+
736+ instance . location = new URL ( mockStatus . preview . url ) ;
737+ instance . status = mockStatus ;
738+ await instance . switchEnv ( 'edit' ) ;
739+ expect ( loadPage . calledWith ( 'https://aemcloud.com/index?cmd=open' ) ) . to . be . true ;
740+ } ) ;
741+
725742 it ( 'switches from review to edit with snapshot path' , async ( ) => {
726743 const fetchStatusStub = sidekickTest . sandbox . stub ( instance , 'fetchStatus' ) ;
727744 const isReviewStub = sidekickTest . sandbox . stub ( instance , 'isReview' ) ;
0 commit comments