Skip to content

Commit 9855a62

Browse files
authored
Pubwise 481 (#8)
* fixes for unit testing
1 parent 341d0f9 commit 9855a62

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

modules/pubwiseBidAdapter.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ export const spec = {
9494
* @return boolean True if this is a valid bid, and false otherwise.
9595
*/
9696
isBidRequestValid: function (bid) {
97-
if (bid.params && bid.params) {
97+
// siteId is required
98+
if (bid.params && bid.params.siteId) {
99+
// it must be a string
98100
if (!utils.isStr(bid.params.siteId)) {
99101
_logWarn('siteId is required for bid', bid);
100102
return false;
101103
}
104+
} else {
105+
return false;
102106
}
103107

104108
return true;

test/spec/modules/pubwiseBidAdapter_spec.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -496,30 +496,29 @@ describe('PubWiseAdapter', function () {
496496
bidder: 'pubwise',
497497
params: {
498498
siteId: 'xxxxxx',
499-
placeHolder: ''
499+
gender: 'M',
500500
}
501501
},
502502
isValid = spec.isBidRequestValid(validBid);
503503
expect(isValid).to.equal(true);
504504
});
505505

506506
it('invalid bid: no siteId', function () {
507-
let validBid = {
507+
let inValidBid = {
508508
bidder: 'pubwise',
509509
params: {
510-
placeHolder: ''
510+
gender: 'M',
511511
}
512512
},
513-
isValid = spec.isBidRequestValid(validBid);
513+
isValid = spec.isBidRequestValid(inValidBid);
514514
expect(isValid).to.equal(false);
515515
});
516516

517-
it('invalid bid: siteId shuold be a sring', function () {
517+
it('invalid bid: siteId should be a string', function () {
518518
let validBid = {
519519
bidder: 'pubwise',
520520
params: {
521-
publisherId: 100000,
522-
placeHolder: ''
521+
siteId: 123456
523522
}
524523
},
525524
isValid = spec.isBidRequestValid(validBid);
@@ -530,7 +529,7 @@ describe('PubWiseAdapter', function () {
530529
describe('Handling Request Construction', function () {
531530
it('bid requests are not mutable', function() {
532531
let sourceBidRequest = utils.deepClone(sampleValidBidRequests)
533-
let request = spec.buildRequests(sampleValidBidRequests, {auctinId: 'placeholder'});
532+
spec.buildRequests(sampleValidBidRequests, {auctinId: 'placeholder'});
534533
expect(sampleValidBidRequests).to.deep.equal(sourceBidRequest, 'Should be unedited as they are used elsewhere');
535534
});
536535
it('should handle complex bidRequest', function() {

0 commit comments

Comments
 (0)