@@ -12,7 +12,8 @@ import 'modules/consentManagementTcf.js';
1212import 'modules/consentManagementUsp.js' ;
1313import 'modules/schain.js' ;
1414
15- const SYNC_URL = 'https://s.ad.smaato.net/c/?adExInit=p'
15+ const IMAGE_SYNC_URL = 'https://s.ad.smaato.net/c/?adExInit=p'
16+ const IFRAME_SYNC_URL = 'https://s.ad.smaato.net/i/?adExInit=p'
1617
1718const ADTYPE_IMG = 'Img' ;
1819const ADTYPE_VIDEO = 'Video' ;
@@ -1670,41 +1671,101 @@ describe('smaatoBidAdapterTest', () => {
16701671 } ) ;
16711672
16721673 describe ( 'getUserSyncs' , ( ) => {
1673- it ( 'when pixelEnabled false then returns no pixels' , ( ) => {
1674+ afterEach ( ( ) => {
1675+ config . resetConfig ( ) ;
1676+ } )
1677+
1678+ it ( 'when pixelEnabled and iframeEnabled false then returns no syncs' , ( ) => {
16741679 expect ( spec . getUserSyncs ( ) ) . to . be . empty
16751680 } )
16761681
1677- it ( 'when pixelEnabled true then returns pixel ' , ( ) => {
1682+ it ( 'when pixelEnabled true then returns image sync ' , ( ) => {
16781683 expect ( spec . getUserSyncs ( { pixelEnabled : true } , null , null , null ) ) . to . deep . equal (
16791684 [
16801685 {
16811686 type : 'image' ,
1682- url : SYNC_URL
1687+ url : IMAGE_SYNC_URL
16831688 }
16841689 ]
16851690 )
16861691 } )
16871692
1688- it ( 'when pixelEnabled true and gdprConsent then returns pixel with gdpr params' , ( ) => {
1693+ it ( 'when iframeEnabled true then returns iframe sync' , ( ) => {
1694+ expect ( spec . getUserSyncs ( { iframeEnabled : true } , null , null , null ) ) . to . deep . equal (
1695+ [
1696+ {
1697+ type : 'iframe' ,
1698+ url : IFRAME_SYNC_URL
1699+ }
1700+ ]
1701+ )
1702+ } )
1703+
1704+ it ( 'when iframeEnabled true and syncsPerBidder then returns iframe sync' , ( ) => {
1705+ config . setConfig ( { userSync : { syncsPerBidder : 5 } } ) ;
1706+ expect ( spec . getUserSyncs ( { iframeEnabled : true } , null , null , null ) ) . to . deep . equal (
1707+ [
1708+ {
1709+ type : 'iframe' ,
1710+ url : `${ IFRAME_SYNC_URL } &maxUrls=5`
1711+ }
1712+ ]
1713+ )
1714+ } )
1715+
1716+ it ( 'when iframeEnabled and pixelEnabled true then returns iframe sync' , ( ) => {
1717+ expect ( spec . getUserSyncs ( { pixelEnabled : true , iframeEnabled : true } , null , null , null ) ) . to . deep . equal (
1718+ [
1719+ {
1720+ type : 'iframe' ,
1721+ url : IFRAME_SYNC_URL
1722+ }
1723+ ]
1724+ )
1725+ } )
1726+
1727+ it ( 'when pixelEnabled true and gdprConsent then returns image sync with gdpr params' , ( ) => {
16891728 expect ( spec . getUserSyncs ( { pixelEnabled : true } , null , { gdprApplies : true , consentString : CONSENT_STRING } , null ) ) . to . deep . equal (
16901729 [
16911730 {
16921731 type : 'image' ,
1693- url : `${ SYNC_URL } &gdpr=1&gdpr_consent=${ CONSENT_STRING } `
1732+ url : `${ IMAGE_SYNC_URL } &gdpr=1&gdpr_consent=${ CONSENT_STRING } `
16941733 }
16951734 ]
16961735 )
16971736 } )
16981737
1699- it ( 'when pixelEnabled true and gdprConsent without gdpr then returns pixel with gdpr_consent' , ( ) => {
1738+ it ( 'when iframeEnabled true and gdprConsent then returns iframe with gdpr params' , ( ) => {
1739+ expect ( spec . getUserSyncs ( { iframeEnabled : true } , null , { gdprApplies : true , consentString : CONSENT_STRING } , null ) ) . to . deep . equal (
1740+ [
1741+ {
1742+ type : 'iframe' ,
1743+ url : `${ IFRAME_SYNC_URL } &gdpr=1&gdpr_consent=${ CONSENT_STRING } `
1744+ }
1745+ ]
1746+ )
1747+ } )
1748+
1749+ it ( 'when pixelEnabled true and gdprConsent without gdpr then returns pixel sync with gdpr_consent' , ( ) => {
17001750 expect ( spec . getUserSyncs ( { pixelEnabled : true } , null , { consentString : CONSENT_STRING } , null ) , null ) . to . deep . equal (
17011751 [
17021752 {
17031753 type : 'image' ,
1704- url : `${ SYNC_URL } &gdpr_consent=${ CONSENT_STRING } `
1754+ url : `${ IMAGE_SYNC_URL } &gdpr_consent=${ CONSENT_STRING } `
17051755 }
17061756 ]
17071757 )
17081758 } )
1759+
1760+ it ( 'when iframeEnabled true and gdprConsent without gdpr then returns iframe sync with gdpr_consent' , ( ) => {
1761+ expect ( spec . getUserSyncs ( { iframeEnabled : true } , null , { consentString : CONSENT_STRING } , null ) , null ) . to . deep . equal (
1762+ [
1763+ {
1764+ type : 'iframe' ,
1765+ url : `${ IFRAME_SYNC_URL } &gdpr_consent=${ CONSENT_STRING } `
1766+ }
1767+ ]
1768+ )
1769+ } )
17091770 } )
17101771} ) ;
0 commit comments