Skip to content

Commit

Permalink
fixes prebid#3128 YieldlabBidAdapter is not using bidRequest.params.a…
Browse files Browse the repository at this point in the history
…dSize (prebid#3129)

* fixes prebid#3128 YieldlabBidAdapter is not using bidRequest.params.adSize as customsize in bidResponse

* fixes prebid#3128 YieldlabBidAdapter is not using bidRequest.params.adSize as customsize in bidResponse - add test
  • Loading branch information
derdeka authored and Pedro López Jiménez committed Mar 18, 2019
1 parent 7eb4451 commit f6c6a35
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
4 changes: 2 additions & 2 deletions modules/yieldlabBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export const spec = {
const bidResponse = {
requestId: bidRequest.bidId,
cpm: matchedBid.price / 100,
width: primarysize[0],
height: primarysize[1],
width: customsize[0],
height: customsize[1],
creativeId: '' + matchedBid.id,
dealId: matchedBid.pid,
currency: CURRENCY_CODE,
Expand Down
34 changes: 25 additions & 9 deletions test/spec/modules/yieldlabBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,36 @@ describe('yieldlabBidAdapter', function () {
})

describe('interpretResponse', function () {
const validRequests = {
validBidRequests: [REQUEST]
}

it('handles nobid responses', function () {
expect(spec.interpretResponse({body: {}}, {validBidRequests: []}).length).to.equal(0)
expect(spec.interpretResponse({body: []}, {validBidRequests: []}).length).to.equal(0)
})

it('should get correct bid response', function () {
const result = spec.interpretResponse({body: [RESPONSE]}, validRequests)
const result = spec.interpretResponse({body: [RESPONSE]}, {validBidRequests: [REQUEST]})

expect(result[0].requestId).to.equal('2d925f27f5079f')
expect(result[0].cpm).to.equal(0.01)
expect(result[0].width).to.equal(728)
expect(result[0].height).to.equal(90)
expect(result[0].creativeId).to.equal('1111')
expect(result[0].dealId).to.equal(2222)
expect(result[0].currency).to.equal('EUR')
expect(result[0].netRevenue).to.equal(false)
expect(result[0].ttl).to.equal(300)
expect(result[0].referrer).to.equal('')
expect(result[0].ad).to.include('<script src="https://ad.yieldlab.net/d/1111/2222/728x90?ts=')
})

it('should get correct bid response when passing more than one size', function () {
const REQUEST2 = Object.assign({}, REQUEST, {
'sizes': [
[800, 250],
[728, 90],
[970, 90],
]
})
const result = spec.interpretResponse({body: [RESPONSE]}, {validBidRequests: [REQUEST2]})

expect(result[0].requestId).to.equal('2d925f27f5079f')
expect(result[0].cpm).to.equal(0.01)
Expand All @@ -118,10 +137,7 @@ describe('yieldlabBidAdapter', function () {
}
}
})
const validRequests = {
validBidRequests: [VIDEO_REQUEST]
}
const result = spec.interpretResponse({body: [RESPONSE]}, validRequests)
const result = spec.interpretResponse({body: [RESPONSE]}, {validBidRequests: [VIDEO_REQUEST]})

expect(result[0].requestId).to.equal('2d925f27f5079f')
expect(result[0].cpm).to.equal(0.01)
Expand Down

0 comments on commit f6c6a35

Please sign in to comment.