Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground XYZ adapter - iframe usersync bug fix #4141

Merged
merged 7 commits into from
Sep 5, 2019
Merged
16 changes: 4 additions & 12 deletions modules/playgroundxyzBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,10 @@ export const spec = {
},

getUserSyncs: function (syncOptions) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: '//acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html'
}];
}
if (syncOptions.pixelEnabled) {
return [{
type: 'image',
url: '//ib.adnxs.com/getuidnb?https://ads.playground.xyz/usersync?partner=appnexus&uid=$UID'
}];
}
return [{
type: 'image',
url: '//ib.adnxs.com/getuidnb?https://ads.playground.xyz/usersync?partner=appnexus&uid=$UID'
}];
}
}

Expand Down
28 changes: 28 additions & 0 deletions test/spec/modules/playgroundxyzBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,32 @@ describe('playgroundxyzBidAdapter', function () {
expect(data.user.ext.consent).to.equal('XYZ-CONSENT');
});
});

describe('getUserSyncs', function () {
const syncUrl = '//ib.adnxs.com/getuidnb?https://ads.playground.xyz/usersync?partner=appnexus&uid=$UID';

describe('when iframeEnabled is true', function () {
const syncOptions = {
'iframeEnabled': true
}
it('should return one image type user sync pixel', function () {
let result = spec.getUserSyncs(syncOptions);
expect(result.length).to.equal(1);
expect(result[0].type).to.equal('image')
expect(result[0].url).to.equal(syncUrl);
});
});

describe('when iframeEnabled is false', function () {
const syncOptions = {
'iframeEnabled': false
}
it('should return one image type user sync pixel', function () {
let result = spec.getUserSyncs(syncOptions);
expect(result.length).to.equal(1);
expect(result[0].type).to.equal('image')
expect(result[0].url).to.equal(syncUrl);
});
});
})
});