File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -443,6 +443,8 @@ var constructor = function () {
443443 . catch ( function ( ) {
444444 logSelectPlacementsEvent ( selectPlacementsAttributes ) ;
445445 } ) ;
446+ } else {
447+ logSelectPlacementsEvent ( selectPlacementsAttributes ) ;
446448 }
447449
448450 return selection ;
Original file line number Diff line number Diff line change @@ -2892,6 +2892,47 @@ describe('Rokt Forwarder', () => {
28922892 ) ;
28932893 } ) ;
28942894
2895+ it ( 'should log event when selectPlacements returns a non-thenable value' , async ( ) => {
2896+ window . Rokt . createLauncher = async function ( ) {
2897+ return Promise . resolve ( {
2898+ selectPlacements : function ( ) {
2899+ // Returns a non-thenable (no .then method)
2900+ return undefined ;
2901+ } ,
2902+ } ) ;
2903+ } ;
2904+
2905+ await window . mParticle . forwarder . init (
2906+ {
2907+ accountId : '123456' ,
2908+ } ,
2909+ reportService . cb ,
2910+ true ,
2911+ null ,
2912+ {
2913+ 'cached-user-attr' : 'cached-value' ,
2914+ }
2915+ ) ;
2916+
2917+ await waitForCondition (
2918+ ( ) => window . mParticle . forwarder . isInitialized
2919+ ) ;
2920+
2921+ await window . mParticle . forwarder . selectPlacements ( {
2922+ identifier : 'test-placement' ,
2923+ attributes : {
2924+ 'new-attr' : 'new-value' ,
2925+ } ,
2926+ } ) ;
2927+
2928+ await waitForCondition ( ( ) => mParticle . loggedEvents . length > 0 ) ;
2929+
2930+ mParticle . loggedEvents . length . should . equal ( 1 ) ;
2931+ mParticle . loggedEvents [ 0 ] . eventName . should . equal (
2932+ 'selectPlacements'
2933+ ) ;
2934+ } ) ;
2935+
28952936 it ( 'should skip logging when mParticle.logEvent is not available' , async ( ) => {
28962937 var originalLogEvent = window . mParticle . logEvent ;
28972938 window . mParticle . logEvent = undefined ;
You can’t perform that action at this time.
0 commit comments