@@ -575,5 +575,59 @@ describe('dasBidAdapter', function () {
575575 const bidResponses = spec . interpretResponse ( nativeResponse ) ;
576576 expect ( bidResponses [ 0 ] . native ) . to . deep . equal ( { } ) ;
577577 } ) ;
578+
579+ describe ( 'user.eids from userIdAsEids' , function ( ) {
580+ const onetEid = {
581+ source : 'onet.pl' ,
582+ inserter : 'onet.pl' ,
583+ uids : [ { id : 'test-artemis-id' , atype : 1 , ext : { id_type : 'tracking' , consent_required : true } } ]
584+ } ;
585+
586+ it ( 'should include user.eids when onet.pl EID is present in userIdAsEids' , function ( ) {
587+ const bidRequestsWithEids = [ {
588+ ...bidRequests [ 0 ] ,
589+ userIdAsEids : [ onetEid ]
590+ } ] ;
591+
592+ const request = spec . buildRequests ( bidRequestsWithEids , bidderRequest ) ;
593+ const payload = JSON . parse ( decodeURIComponent ( new URL ( request . url ) . searchParams . get ( 'data' ) ) ) ;
594+
595+ expect ( payload . user . eids ) . to . be . an ( 'array' ) . with . lengthOf ( 1 ) ;
596+ expect ( payload . user . eids [ 0 ] . source ) . to . equal ( 'onet.pl' ) ;
597+ expect ( payload . user . eids [ 0 ] . inserter ) . to . equal ( 'onet.pl' ) ;
598+ expect ( payload . user . eids [ 0 ] . uids [ 0 ] . id ) . to . equal ( 'test-artemis-id' ) ;
599+ expect ( payload . user . eids [ 0 ] . uids [ 0 ] . atype ) . to . equal ( 1 ) ;
600+ expect ( payload . user . eids [ 0 ] . uids [ 0 ] . ext . id_type ) . to . equal ( 'tracking' ) ;
601+ expect ( payload . user . eids [ 0 ] . uids [ 0 ] . ext . consent_required ) . to . equal ( true ) ;
602+ } ) ;
603+
604+ it ( 'should not include user.eids when userIdAsEids is absent' , function ( ) {
605+ const request = spec . buildRequests ( bidRequests , bidderRequest ) ;
606+ const payload = JSON . parse ( decodeURIComponent ( new URL ( request . url ) . searchParams . get ( 'data' ) ) ) ;
607+
608+ expect ( payload . user ) . to . not . have . property ( 'eids' ) ;
609+ } ) ;
610+
611+ it ( 'should not include user.eids when userIdAsEids contains no onet.pl source' , function ( ) {
612+ const bidRequestsWithOtherEid = [ {
613+ ...bidRequests [ 0 ] ,
614+ userIdAsEids : [ { source : 'other-source.com' , uids : [ { id : 'some-id' , atype : 1 } ] } ]
615+ } ] ;
616+
617+ const request = spec . buildRequests ( bidRequestsWithOtherEid , bidderRequest ) ;
618+ const payload = JSON . parse ( decodeURIComponent ( new URL ( request . url ) . searchParams . get ( 'data' ) ) ) ;
619+
620+ expect ( payload . user ) . to . not . have . property ( 'eids' ) ;
621+ } ) ;
622+
623+ it ( 'should not include user.eids when userIdAsEids is empty' , function ( ) {
624+ const bidRequestsWithEmptyEids = [ { ...bidRequests [ 0 ] , userIdAsEids : [ ] } ] ;
625+
626+ const request = spec . buildRequests ( bidRequestsWithEmptyEids , bidderRequest ) ;
627+ const payload = JSON . parse ( decodeURIComponent ( new URL ( request . url ) . searchParams . get ( 'data' ) ) ) ;
628+
629+ expect ( payload . user ) . to . not . have . property ( 'eids' ) ;
630+ } ) ;
631+ } ) ;
578632 } ) ;
579633} ) ;
0 commit comments