it('handles empty bid response', function () { let response = { body: {} }; let result = spec.interpretResponse(response); expect(result.length).to.equal(0); });
it('should attempt to send bid requests to the endpoint via GET', function () { const requests = spec.buildRequests(bidArray); requests.forEach(function(requestItem) { expect(requestItem.method).to.equal('GET'); expect(requestItem.url).to.match(new RegExp(`hb.gammaplatform.com`)); }); });
it('should get the correct bid response', function () { let expectedResponse = [{ 'requestId': '23beaa6af6cdde', 'cpm': 0.45, 'width': 300, 'height': 250, 'creativeId': '1515999070', 'dealId': 'gax-paj2qarjf2g', 'currency': 'USD', 'netRevenue': true, 'ttl': 300, 'ad': '<!-- adtag -->' }]; let result = spec.interpretResponse(serverResponse); expect(Object.keys(result)).to.deep.equal(Object.keys(expectedResponse)); });
it('should return false when params not passed correctly', function () { bid.params.siteId = ''; bid.params.zoneId = ''; expect(spec.isBidRequestValid(bid)).to.equal(false); });
it('should return false when require params are not passed', function () { let bid = Object.assign({}, bid); bid.params = {}; expect(spec.isBidRequestValid(bid)).to.equal(false); });
it('should return true when required params found', function () { expect(spec.isBidRequestValid(bid)).to.equal(true); });