Skip to content

Commit

Permalink
Playground XYZ adapter - iframe usersync bug fix (#4141)
Browse files Browse the repository at this point in the history
* corrected user sync type

* removed support for iframe usersync

* added unit tests for getUserSyncs
  • Loading branch information
monofonik authored and bretg committed Sep 5, 2019
1 parent c47bb80 commit 67e3a9c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
16 changes: 4 additions & 12 deletions modules/playgroundxyzBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,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);
});
});
})
});

0 comments on commit 67e3a9c

Please sign in to comment.