@@ -51,15 +51,15 @@ jest.mock('../../../core/Braze', () => ({
5151} ) ) ;
5252
5353// ---------------------------------------------------------------------------
54- // Mock: deeplink handler
54+ // Mock: SharedDeeplinkManager
5555// ---------------------------------------------------------------------------
56- const mockHandleDeeplink = jest . fn ( ) ;
57- jest . mock (
58- '../../../core/DeeplinkManager/handlers/legacy/handleDeeplink' ,
59- ( ) => ( {
60- handleDeeplink : ( ... args : unknown [ ] ) => mockHandleDeeplink ( ... args ) ,
61- } ) ,
62- ) ;
56+ const mockParse = jest . fn ( ) . mockResolvedValue ( undefined ) ;
57+ jest . mock ( '../../../core/DeeplinkManager/DeeplinkManager' , ( ) => ( {
58+ __esModule : true ,
59+ default : {
60+ getInstance : ( ) => ( { parse : mockParse } ) ,
61+ } ,
62+ } ) ) ;
6363
6464// ---------------------------------------------------------------------------
6565// Mock: isAllowedBrazeDeeplink — default to true; individual tests can override
@@ -149,7 +149,7 @@ function makeRawProperties(props: {
149149 body : { type : 'string' , value : props . body ?? 'Default body text' } ,
150150 } ;
151151 if ( props . bannerName !== undefined )
152- result . banner_name = { type : 'string' , value : props . bannerName } ;
152+ result . campaign_name = { type : 'string' , value : props . bannerName } ;
153153 if ( props . dismissable !== undefined )
154154 result . dismissable = { type : 'boolean' , value : props . dismissable } ;
155155 if ( props . deeplink !== undefined )
@@ -192,9 +192,9 @@ type BannerState = 'loading' | 'visible' | 'empty';
192192
193193/**
194194 * Asserts the complete set of structural test IDs for a given banner state:
195- * - `loading` → CONTAINER + SKELETON present; PRESSABLE + DISMISS_BUTTON absent
196- * - `visible` → CONTAINER + PRESSABLE + DISMISS_BUTTON present; SKELETON absent
197- * - `empty` → all four absent (component returns null)
195+ * - `loading` → CONTAINER present; PRESSABLE + DISMISS_BUTTON absent
196+ * - `visible` → CONTAINER + PRESSABLE + DISMISS_BUTTON present
197+ * - `empty` → all absent (component returns null)
198198 */
199199function assertBannerState (
200200 queryByTestId : ( id : string ) => unknown ,
@@ -205,17 +205,14 @@ function assertBannerState(
205205
206206 if ( state === 'loading' ) {
207207 present ( BRAZE_BANNER_TEST_IDS . CONTAINER ) ;
208- present ( BRAZE_BANNER_TEST_IDS . SKELETON ) ;
209208 absent ( BRAZE_BANNER_TEST_IDS . PRESSABLE ) ;
210209 absent ( BRAZE_BANNER_TEST_IDS . DISMISS_BUTTON ) ;
211210 } else if ( state === 'visible' ) {
212211 present ( BRAZE_BANNER_TEST_IDS . CONTAINER ) ;
213- absent ( BRAZE_BANNER_TEST_IDS . SKELETON ) ;
214212 present ( BRAZE_BANNER_TEST_IDS . PRESSABLE ) ;
215213 present ( BRAZE_BANNER_TEST_IDS . DISMISS_BUTTON ) ;
216214 } else {
217215 absent ( BRAZE_BANNER_TEST_IDS . CONTAINER ) ;
218- absent ( BRAZE_BANNER_TEST_IDS . SKELETON ) ;
219216 absent ( BRAZE_BANNER_TEST_IDS . PRESSABLE ) ;
220217 absent ( BRAZE_BANNER_TEST_IDS . DISMISS_BUTTON ) ;
221218 }
@@ -380,7 +377,7 @@ describe('BrazeBanner', () => {
380377
381378 expect ( mockLogBrazeBannerImpression ) . toHaveBeenCalledWith (
382379 TEST_PLACEMENT_ID ,
383- { banner_name : 'campaign-abc' } ,
380+ { campaign_name : 'campaign-abc' } ,
384381 ) ;
385382 expect ( mockLogBrazeBannerImpression ) . toHaveBeenCalledTimes ( 1 ) ;
386383 } ) ;
@@ -403,7 +400,7 @@ describe('BrazeBanner', () => {
403400 } ) ;
404401
405402 describe ( 'banner tap' , ( ) => {
406- it ( 'calls logBrazeBannerClick and handleDeeplink when banner has a deeplink' , ( ) => {
403+ it ( 'calls logBrazeBannerClick and SharedDeeplinkManager.parse when banner has a deeplink' , ( ) => {
407404 const { getByTestId } = render (
408405 < BrazeBanner placementId = { TEST_PLACEMENT_ID } /> ,
409406 ) ;
@@ -412,9 +409,8 @@ describe('BrazeBanner', () => {
412409 fireEvent . press ( getByTestId ( BRAZE_BANNER_TEST_IDS . PRESSABLE ) ) ;
413410
414411 expect ( mockLogBrazeBannerClick ) . toHaveBeenCalledWith ( TEST_PLACEMENT_ID ) ;
415- expect ( mockHandleDeeplink ) . toHaveBeenCalledWith ( {
416- uri : 'metamask://portfolio' ,
417- source : 'braze' ,
412+ expect ( mockParse ) . toHaveBeenCalledWith ( 'metamask://portfolio' , {
413+ origin : 'braze' ,
418414 } ) ;
419415 } ) ;
420416
@@ -426,11 +422,11 @@ describe('BrazeBanner', () => {
426422 fireBannerEvent ( [ makeBanner ( ) ] ) ;
427423 fireEvent . press ( getByTestId ( BRAZE_BANNER_TEST_IDS . PRESSABLE ) ) ;
428424
429- expect ( mockHandleDeeplink ) . not . toHaveBeenCalled ( ) ;
425+ expect ( mockParse ) . not . toHaveBeenCalled ( ) ;
430426 expect ( mockLogBrazeBannerClick ) . not . toHaveBeenCalled ( ) ;
431427 } ) ;
432428
433- it ( 'does not call handleDeeplink or logBrazeBannerClick when deeplink is rejected by the allowlist' , ( ) => {
429+ it ( 'does not call SharedDeeplinkManager.parse or logBrazeBannerClick when deeplink is rejected by the allowlist' , ( ) => {
434430 mockIsAllowedBrazeDeeplink . mockReturnValueOnce ( false ) ;
435431
436432 const { getByTestId } = render (
@@ -442,7 +438,7 @@ describe('BrazeBanner', () => {
442438 ] ) ;
443439 fireEvent . press ( getByTestId ( BRAZE_BANNER_TEST_IDS . PRESSABLE ) ) ;
444440
445- expect ( mockHandleDeeplink ) . not . toHaveBeenCalled ( ) ;
441+ expect ( mockParse ) . not . toHaveBeenCalled ( ) ;
446442 expect ( mockLogBrazeBannerClick ) . not . toHaveBeenCalled ( ) ;
447443 } ) ;
448444
0 commit comments