it('should register the sync iframe', function () { expect(spec.getUserSyncs({})).to.be.undefined; expect(spec.getUserSyncs({iframeEnabled: false})).to.be.undefined; const options = spec.getUserSyncs({iframeEnabled: true}); expect(options).to.not.be.undefined; expect(options).to.have.lengthOf(1); expect(options[0].type).to.equal('iframe'); expect(options[0].url).to.equal(syncUrl); });
it('should return false when required params are not passed', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { 'zoneid': 0, }; expect(spec.isBidRequestValid(bid)).to.equal(false); });
it('should return true when required params found', function () { let bid = Object.assign({}, bid); delete bid.params; bid.params = { 'zoneid': '37', }; expect(spec.isBidRequestValid(bid)).to.equal(true); });
it('handles nobid responses', function () { let response = { 'id': '543210', 'seatbid': [ ] }; let result = spec.interpretResponse({ body: response }); expect(result.length).to.equal(0); });
it('should add source and verison to the tag', function () { const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); const payload = request.data; expect(payload.from).to.exist; expect(payload.v).to.exist; expect(payload.request_id).to.exist; expect(payload.imp_id).to.exist; expect(payload.aff).to.exist; expect(payload.bid_floor).to.exist; expect(payload.charset).to.exist; expect(payload.site_domain).to.exist; expect(payload.site_page).to.exist; expect(payload.subid).to.exist; expect(payload.flashver).to.exist; expect(payload.tmax).to.exist; });
it('should get correct bid response', function () { let expectedResponse = [ { requestId: 'bidId-123456-1', creativeId: 'bidId-123456-1', cpm: 0.09, width: 728, height: 90, ad: '<!-- Creative -->', netRevenue: true, currency: 'USD', ttl: 360, } ]; let result = spec.interpretResponse({ body: response }); expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0])); });
it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); });
it('sends bid request to ENDPOINT via GET', function () { const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest); expect(request.url).to.equal('//bidding.rtbdemand.com/hb'); expect(request.method).to.equal('GET'); });