From 84f2d69b688c6877428f89cfa5978fc0bf4ae926 Mon Sep 17 00:00:00 2001 From: Sebastien Robert Date: Mon, 26 Jul 2021 17:20:20 +0200 Subject: [PATCH] Add tests on consent and response --- test/spec/modules/beopBidAdapter_spec.js | 49 +++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/test/spec/modules/beopBidAdapter_spec.js b/test/spec/modules/beopBidAdapter_spec.js index 7fd3455d2bf..0432943ed9e 100644 --- a/test/spec/modules/beopBidAdapter_spec.js +++ b/test/spec/modules/beopBidAdapter_spec.js @@ -93,7 +93,54 @@ describe('BeOp Bid Adapter tests', () => { it('should call the endpoint with GDPR consent and pageURL info if found', function () { let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='; - const request = spec.buildRequests(bidRequests, {}); + let bidderRequest = + { + 'gdprConsent': + { + 'gdprApplies': true, + 'consentString': consentString + }, + 'refererInfo': + { + 'canonicalUrl': 'http://test.te' + } + }; + + const request = spec.buildRequests(bidRequests, bidderRequest); + const payload = JSON.parse(request.data); + expect(payload.tc_string).to.exist; + expect(payload.tc_string).to.equal('BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='); + expect(payload.url).to.exist; + expect(payload.url).to.equal('http://test.te'); + }); + }); + + describe('interpretResponse', function() { + let serverResponse = { + 'body': { + 'bids': [ + { + 'requestId': 'aaaa', + 'cpm': 1.0, + 'currency': 'EUR', + 'creativeId': '60f691be1515670a2a09aea2', + 'netRevenue': true, + 'width': 1, + 'height': 1, + 'ad': '
', + 'meta': { + 'advertiserId': '60f691be1515670a2a09aea1' + } + } + ] + } + } + it('should interpret the response by pushing it in the bids elem', function () { + const response = spec.interpretResponse(serverResponse, validBid); + + expect(response[0].ad).to.exist; + expect(response[0].requestId).to.exist; + expect(response[0].requestId).to.equal('aaaa'); }); });