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

Adding schain info #26

Merged
merged 3 commits into from
Jun 11, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion modules/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ function _createServerRequest(bidRequest, gdprConsent = {}, uspConsent, pageUrl)
} ]
}
};


if(bidRequest.schain) {
ttxRequest.source = {
ext: {
schain: bidRequest.schain
}
}
}

// Finally, set the openRTB 'test' param if this is to be a test bid
if (params.test === 1) {
ttxRequest.test = 1;
Expand Down
81 changes: 81 additions & 0 deletions test/spec/modules/33acrossBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ describe('33acrossBidAdapter:', function () {
return this;
};

this.withSchain = schain => {
Object.assign(ttxRequest, {
source: {
ext: {
schain
}
}
});

return this;
};

this.build = () => ttxRequest;
}

Expand Down Expand Up @@ -589,8 +601,77 @@ describe('33acrossBidAdapter:', function () {
expect(builtServerRequests).to.deep.equal([serverRequest]);
});
});

context('when there is schain object in the bidRequest', function() {
it('builds request with schain info in source', function() {
const schainValues = [
{
'ver': "1.0",
'complete': 1,
'nodes': [
{
'asi': "bidderA.com",
'sid': "00001",
'hp': 1
}
]
},
{
'ver': "1.0",
'complete': 1,
},
{
'ver': "1.0",
'complete': 1,
'nodes': []
},
{
'ver': "1.0",
'complete': '1',
'nodes': [
{
'asi': "bidderA.com",
'sid': "00001",
'hp': 1
}
]
}
];

schainValues.forEach((schain)=> {
bidRequests[0].schain = schain;

const ttxRequest = new TtxRequestBuilder()
.withSchain(schain)
.build();
const serverRequest = new ServerRequestBuilder()
.withData(ttxRequest)
.build();

const builtServerRequests = spec.buildRequests(bidRequests, {});

expect(builtServerRequests).to.deep.equal([serverRequest]);
});
});
});

context('when there no schain object is passed', function() {
it('does not set source field', function() {
const ttxRequest = new TtxRequestBuilder()
.build();

const serverRequest = new ServerRequestBuilder()
.withData(ttxRequest)
.build();

const builtServerRequests = spec.buildRequests(bidRequests, {});

expect(builtServerRequests).to.deep.equal([serverRequest]);
});
});
});


describe('interpretResponse', function() {
let ttxRequest, serverRequest;

Expand Down