Skip to content

Commit

Permalink
Dailymotion bid adapter: Fix user sync parsing (#11887)
Browse files Browse the repository at this point in the history
This fixes an issue in the server response parsing for user sync, where it was not using the body from the response. I took the occasion to also convert this member to camelCase for consistency with the others.

Co-authored-by: Kevin Siow <[email protected]>
  • Loading branch information
sebmil-daily and Kevin Siow committed Jun 28, 2024
1 parent 67774de commit 0c560a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion modules/dailymotionBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export const spec = {
const pixelSyncs = [];

serverResponses.forEach((response) => {
(response.user_syncs || []).forEach((syncUrl) => {
(response?.body?.userSyncs || []).forEach((syncUrl) => {
if (syncUrl.type === 'image') {
pixelSyncs.push({ url: syncUrl.url, type: 'image' });
}
Expand Down
32 changes: 18 additions & 14 deletions test/spec/modules/dailymotionBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ describe('dailymotionBidAdapterTests', () => {

// No permissions
{
const responses = [{ user_syncs: [{ url: 'https://usersyncurl.com', type: 'image' }] }];
const responses = [{ body: { userSyncs: [{ url: 'https://usersyncurl.com', type: 'image' }] } }];
const syncOptions = { iframeEnabled: false, pixelEnabled: false };

expect(config.runWithBidder(
Expand All @@ -656,7 +656,7 @@ describe('dailymotionBidAdapterTests', () => {
)).to.eql([]);
}

// Has permissions but no user_syncs urls
// Has permissions but no userSyncs urls
{
const responses = [{}];
const syncOptions = { iframeEnabled: false, pixelEnabled: true };
Expand All @@ -667,14 +667,16 @@ describe('dailymotionBidAdapterTests', () => {
)).to.eql([]);
}

// Return user_syncs urls for pixels
// Return userSyncs urls for pixels
{
const responses = [{
user_syncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
body: {
userSyncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
}
}];

const syncOptions = { iframeEnabled: false, pixelEnabled: true };
Expand All @@ -688,14 +690,16 @@ describe('dailymotionBidAdapterTests', () => {
]);
}

// Return user_syncs urls for iframes
// Return userSyncs urls for iframes
{
const responses = [{
user_syncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
body: {
userSyncs: [
{ url: 'https://usersyncurl.com', type: 'image' },
{ url: 'https://usersyncurl2.com', type: 'image' },
{ url: 'https://usersyncurl3.com', type: 'iframe' }
],
}
}];

const syncOptions = { iframeEnabled: true, pixelEnabled: true };
Expand Down

0 comments on commit 0c560a3

Please sign in to comment.