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

Ogury Bid Adapter: fix getusersync method #7472

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/oguryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function getUserSyncs(syncOptions, serverResponses, gdprConsent, uspConsent) {

return [{
type: 'image',
url: `${MS_COOKIE_SYNC_DOMAIN}/v1/init-sync/bid-switch?iab_string=${gdprConsent.consentString}&source=prebid`
url: `${MS_COOKIE_SYNC_DOMAIN}/v1/init-sync/bid-switch?iab_string=${(gdprConsent && gdprConsent.consentString) || ''}&source=prebid`
}]
}

Expand Down
66 changes: 66 additions & 0 deletions test/spec/modules/oguryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,72 @@ describe('OguryBidAdapter', function () {
syncOptions.pixelEnabled = false;
expect(spec.getUserSyncs(syncOptions, [], gdprConsent)).to.have.lengthOf(0);
});

it('should return syncs array with an element of type image when consentString is undefined', () => {
gdprConsent = {
gdprApplies: true,
consentString: undefined
};

const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
expect(userSyncs).to.have.lengthOf(1);
expect(userSyncs[0].type).to.equal('image');
expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
});

it('should return syncs array with an element of type image when consentString is null', () => {
gdprConsent = {
gdprApplies: true,
consentString: null
};

const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
expect(userSyncs).to.have.lengthOf(1);
expect(userSyncs[0].type).to.equal('image');
expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
});

it('should return syncs array with an element of type image when gdprConsent is undefined', () => {
gdprConsent = undefined;

const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
expect(userSyncs).to.have.lengthOf(1);
expect(userSyncs[0].type).to.equal('image');
expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
});

it('should return syncs array with an element of type image when gdprConsent is null', () => {
gdprConsent = null;

const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
expect(userSyncs).to.have.lengthOf(1);
expect(userSyncs[0].type).to.equal('image');
expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
});

it('should return syncs array with an element of type image when gdprConsent is null and gdprApplies is false', () => {
gdprConsent = {
gdprApplies: false,
consentString: null
};

const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
expect(userSyncs).to.have.lengthOf(1);
expect(userSyncs[0].type).to.equal('image');
expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
});

it('should return syncs array with an element of type image when gdprConsent is empty string and gdprApplies is false', () => {
gdprConsent = {
gdprApplies: false,
consentString: ''
};

const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
expect(userSyncs).to.have.lengthOf(1);
expect(userSyncs[0].type).to.equal('image');
expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
});
});

describe('buildRequests', function () {
Expand Down