-
Notifications
You must be signed in to change notification settings - Fork 224
Test: Bid rounding #3903
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
Test: Bid rounding #3903
Conversation
…g' into qaa/bid-rounding
|
|
||
| class BidRoundingSpec extends BaseSpec { | ||
|
|
||
| def "PBS should round bid value to the down when account bid rounding empty or unknown"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PBS should round bid value down when account bid rounding setting is #bidRoundingValue. Same for others
| accountDao.save(account) | ||
|
|
||
| and: "Default bid response" | ||
| def bidPrice = PBSUtils.getRandomFloorValue(0.15, 0.19) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic numbers
| def "PBS should round bid value to the 50% down and 50% up when account bid rounding time split"() { | ||
| given: "Default bid request" | ||
| def bidRequest = BidRequest.getDefaultBidRequest().tap { | ||
| ext.prebid.targeting = new Targeting() | ||
| } | ||
|
|
||
| and: "Account in the DB" | ||
| def account = getAccountWithBidRounding(bidRequest.accountId, accountAuctionConfig) | ||
| accountDao.save(account) | ||
|
|
||
| and: "Default bid response" | ||
| def bidPrice = PBSUtils.randomFloorValue | ||
| def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { | ||
| seatbid[0].bid[0].price = bidPrice | ||
| } | ||
| bidder.setResponse(bidRequest.id, bidResponse) | ||
|
|
||
| when: "PBS processes auction request" | ||
| def response = defaultPbsService.sendAuctionRequest(bidRequest) | ||
|
|
||
| then: "Targeting hb_pb should be round" | ||
| def targeting = response.seatbid[0].bid[0].ext.prebid.targeting | ||
| assert targeting["hb_pb"] == getRoundedTargetingValueWithDefaultPrecision(bidPrice) || | ||
| getRoundedTargetingValueWithUpPrecision(bidPrice) | ||
|
|
||
| where: | ||
| accountAuctionConfig << [new AccountAuctionConfig(bidRounding: TIME_SPLIT), | ||
| new AccountAuctionConfig(bidRoundingSnakeCase: TIME_SPLIT)] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never use the or operator in the assert statement. Besides, I’m not sure this test is valid or helpful in any way because it will always pass
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check