Skip to content

Commit

Permalink
send purposes in string array
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Grigoras committed Jul 28, 2020
1 parent 06f9638 commit f0cdb88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
5 changes: 1 addition & 4 deletions modules/invibesBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ function buildRequest(bidRequests, bidderRequest) {
oi: invibes.optIn,

kw: keywords,
p1: invibes.purposes[0],
p2and7: invibes.purposes[1] && invibes.purposes[6],
p9: invibes.purposes[8],
onePMissing: invibes.purposes.every(Boolean)
purposes: invibes.purposes.toString()
};

if (lid) {
Expand Down
34 changes: 3 additions & 31 deletions test/spec/modules/invibesBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('invibesBidAdapter:', function () {
}
};
let request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.p1).to.equal(true);
expect(request.data.purposes.split(',')[0]).to.equal('true');
});

it('should send purpose 2 & 7', function () {
Expand Down Expand Up @@ -243,7 +243,7 @@ describe('invibesBidAdapter:', function () {
}
};
let request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.p2and7).to.equal(true);
expect(request.data.purposes.split(',')[1] && request.data.purposes.split(',')[6]).to.equal('true');
});

it('should send purpose 9', function () {
Expand Down Expand Up @@ -271,35 +271,7 @@ describe('invibesBidAdapter:', function () {
}
};
let request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.p9).to.equal(true);
});

it('should send purpose oneMissing', function () {
let bidderRequest = {
gdprConsent: {
vendorData: {
gdprApplies: true,
hasGlobalConsent: false,
vendor: {consents: {436: true}},
purpose: {
consents: {
1: true,
2: true,
3: true,
4: true,
5: false,
6: true,
7: true,
8: true,
9: true,
10: true
}
}
}
}
};
let request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.onePMissing).to.equal(false);
expect(request.data.purposes.split(',')[9]).to.equal('true');
});

it('should send oi = 0 when vendorData is null', function () {
Expand Down

0 comments on commit f0cdb88

Please sign in to comment.