Skip to content

Commit

Permalink
GumGum: adds support for new field - irisid (#6129)
Browse files Browse the repository at this point in the history
* adds support for new field - irisid

* remove package-lock.json

* revert psckage-lock.json to source
  • Loading branch information
lbenmore committed Dec 22, 2020
1 parent 4bfd475 commit be14e4c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ function buildRequests (validBidRequests, bidderRequest) {
data.iriscat = params.iriscat;
}

if (params.irisid && typeof params.irisid === 'string') {
data.irisid = params.irisid;
}

if (params.zone || params.pubId) {
params.zone ? (data.t = params.zone) : (data.pubId = params.pubId);

Expand Down
33 changes: 32 additions & 1 deletion test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { BANNER, VIDEO } from 'src/mediaTypes.js';

import { expect } from 'chai';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { spec } from 'modules/gumgumBidAdapter.js';
import { BANNER, VIDEO } from 'src/mediaTypes.js';

const ENDPOINT = 'https://g2.gumgum.com/hbid/imp';
const JCSI = { t: 0, rq: 8, pbv: '$prebid.version$' }
Expand Down Expand Up @@ -158,6 +159,36 @@ describe('gumgumAdapter', function () {
expect(bidRequest.data.t).to.equal(zoneParam.zone);
});

it('should set the iriscat param when found', function () {
const request = { ...bidRequests[0], params: { iriscat: 'abc123' } }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.have.property('iriscat');
});

it('should not set the iriscat param when not found', function () {
const request = { ...bidRequests[0] }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.not.have.property('iriscat');
});

it('should set the irisid param when found', function () {
const request = { ...bidRequests[0], params: { irisid: 'abc123' } }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.have.property('irisid');
});

it('should not set the irisid param when not found', function () {
const request = { ...bidRequests[0] }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.not.have.property('irisid');
});

it('should not set the irisid param when not of type string', function () {
const request = { ...bidRequests[0], params: { irisid: 123456 } }
const bidRequest = spec.buildRequests([request])[0];
expect(bidRequest.data).to.not.have.property('irisid');
});

describe('product id', function () {
it('should set the correct pi param if native param is found', function () {
const request = { ...bidRequests[0], params: { ...zoneParam, native: 2 } };
Expand Down

0 comments on commit be14e4c

Please sign in to comment.