Skip to content

Commit

Permalink
Missena Bid Adapter: added getUserSyncs and testmode (prebid#8547)
Browse files Browse the repository at this point in the history
* Missena Bid Adapter: added getUserSyncs and testmode

* Slight parameter rename

* Add getUserSyncs tests

* Hardcode the sync url
  • Loading branch information
pdamoc authored and bwhisp committed Jul 13, 2022
1 parent 5f3f3d3 commit c0a6761
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
10 changes: 9 additions & 1 deletion modules/missenaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export const spec = {
payload.consent_required = bidderRequest.gdprConsent.gdprApplies;
}
const baseUrl = bidRequest.params.baseUrl || ENDPOINT_URL;
if (bidRequest.params.test) {
payload.test = bidRequest.params.test;
}
return {
method: 'POST',
url: baseUrl + '?' + formatQS({ t: bidRequest.params.apiKey }),
Expand All @@ -69,7 +72,12 @@ export const spec = {

return bidResponses;
},

getUserSyncs: function (syncOptions, serverResponses) {
if (!syncOptions.iframeEnabled) {
return [];
}
return [{ type: 'iframe', url: 'https://sync.missena.io/iframe' }];
},
/**
* Register bidder specific code, which will execute if bidder timed out after an auction
* @param {data} Containing timeout specific data
Expand Down
25 changes: 24 additions & 1 deletion test/spec/modules/missenaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('Missena Adapter', function () {
currency: 'USD',
ad: '<!-- -->',
meta: {
advertiserDomains: ['missena.com']
advertiserDomains: ['missena.com'],
},
};

Expand Down Expand Up @@ -131,4 +131,27 @@ describe('Missena Adapter', function () {
expect(result).to.deep.equal([]);
});
});

describe('getUserSyncs', function () {
const expectedUserSyncs = [
{ type: 'iframe', url: 'https://sync.missena.io/iframe' },
];
const serverResponses = [];

it('should return userSync when iframeEnabled', function () {
const syncOptions = {
iframeEnabled: true,
};
const userSyncs = spec.getUserSyncs(syncOptions, serverResponses);
expect(userSyncs).to.deep.equal(expectedUserSyncs);
});

it('should return empty array when iframeEnabled is false', function () {
const syncOptions = {
iframeEnabled: false,
};
const userSyncs = spec.getUserSyncs(syncOptions, serverResponses);
expect(userSyncs).to.deep.equal([]);
});
});
});

0 comments on commit c0a6761

Please sign in to comment.