it('should be false because the env is missing or wrong', function () { let wrongBid = utils.deepClone(bid); wrongBid.params.env = 'us'; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; wrongBid = utils.deepClone(bid); delete wrongBid.params.env; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; });
it('should be false because the sizes are missing or in the wrong format', function () { let wrongBid = utils.deepClone(bid); wrongBid.sizes = '640360'; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; wrongBid = utils.deepClone(bid); delete wrongBid.sizes; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; });
it('should be false because the mediaType is missing or wrong', function () { let wrongBid = utils.deepClone(bid); wrongBid.mediaTypes = {}; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; wrongBid = utils.deepClone(bid); delete wrongBid.mediaTypes; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; });
it('should be empty because the body is missing or wrong', function () { let wrongResponse = utils.deepClone(response); wrongResponse.body = [1, 2, 3]; expect(adapter.interpretResponse(wrongResponse, bid)).to.be.empty; wrongResponse = utils.deepClone(response); delete wrongResponse.body; expect(adapter.interpretResponse(wrongResponse, bid)).to.be.empty; });
it('should return an empty array', function () { expect(adapter.getUserSyncs({}, [])).to.be.empty; expect(adapter.getUserSyncs({}, [])).to.be.empty; expect(adapter.getUserSyncs(syncOptions, [response])).to.be.empty; expect(adapter.getUserSyncs(syncOptions, [response])).to.be.empty; syncOptions.iframeEnabled = true; expect(adapter.getUserSyncs(syncOptions, [response])).to.be.empty; expect(adapter.getUserSyncs(syncOptions, [response])).to.be.empty; });
it('should be false because params.zoneId is missing', function () { let wrongBid = utils.deepClone(bid); delete wrongBid.params.zoneId; expect(adapter.isBidRequestValid(wrongBid)).to.be.false; });
it('should be true', function () { expect(adapter.isBidRequestValid(bid)).to.be.true; });
it('should be equal to the expected result', function () { response.body.iframeSync = 'http://player.mediabong.net/csifr?1234'; expect(adapter.getUserSyncs(syncOptions, [response])).to.deep.equal([result]); })
it('should equal to the expected formatted result', function () { response.body.renderer_url = 'vuble_renderer.js'; result.adUnitCode = 'code'; let formattedResponses = adapter.interpretResponse(response, bid); expect(formattedResponses[0].adUnitCode).to.equal(result.adUnitCode); });
it('should equal to the expected formatted result', function () { expect(adapter.interpretResponse(response, bid)).to.deep.equal([result]); });
it('must return the right formatted requests', function () { let rs = adapter.buildRequests([bid1, bid2]); expect(adapter.buildRequests([bid1, bid2])).to.deep.equal([request1, request2]); });