コード例 #1
0
 it('should return One Mobile url with required params - dcn & pos', function () {
   let bidRequest = createCustomBidRequest({
     params: getNexageGetBidParams()
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain(NEXAGE_URL + 'dcn=2c9d2b50015c5ce9db6aeeed8b9500d6&pos=header');
 });
コード例 #2
0
 it('should return formatted params when formatConsentData returns data', function () {
   formatConsentDataStub.returns({
     euconsent: 'test-consent',
     gdpr: 1
   });
   expect(spec.formatMarketplaceDynamicParams()).to.be.equal('euconsent=test-consent;gdpr=1;');
 });
コード例 #3
0
 it('should return One Mobile url with cmd=bid option', function () {
   let bidRequest = createCustomBidRequest({
     params: getNexageGetBidParams()
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('cmd=bid');
 });
コード例 #4
0
 it('should return One Mobile url when One Mobile get params are present', function () {
   let bidRequest = createCustomBidRequest({
     params: getNexageGetBidParams()
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain(NEXAGE_URL);
 });
コード例 #5
0
 it('should return formatted gdpr params when isConsentRequired returns true', function () {
   let consentData = {
     consentString: 'test-consent'
   };
   consentRequiredStub.returns(true);
   expect(spec.formatOneMobileDynamicParams({}, consentData)).to.be.equal('&gdpr=1&euconsent=test-consent');
 });
コード例 #6
0
 it('should return One Mobile url when One Mobile and Marketplace params are present', function () {
   let bidParams = Object.assign(getNexageGetBidParams(), getMarketplaceBidParams());
   let bidRequest = createCustomBidRequest({
     params: bidParams
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain(NEXAGE_URL);
 });
コード例 #7
0
    it('should return user syncs if pixels are present in the response', function () {
      let userSyncs = spec.getUserSyncs({}, serverResponses);

      expect(userSyncs).to.deep.equal([
        {type: 'image', url: 'img.org'},
        {type: 'iframe', url: 'pixels1.org'}
      ]);
    });
コード例 #8
0
    it('should return true when gdprApplies equals true and consentString is not present', function () {
      let consentData = {
        consentString: null,
        gdprApplies: true
      };

      expect(spec.isConsentRequired(consentData)).to.be.true;
    });
コード例 #9
0
    it('should return true when consentString is present and gdprApplies equals true', function () {
      let consentData = {
        consentString: 'consent-string',
        gdprApplies: true
      };

      expect(spec.isConsentRequired(consentData)).to.be.true;
    });
コード例 #10
0
 it('should return formatted params when formatKeyValues returns data', function () {
   formatKeyValuesStub.returns({
     param1: 'val1',
     param2: 'val2',
     param3: 'val3'
   });
   expect(spec.formatMarketplaceDynamicParams()).to.be.equal('param1=val1;param2=val2;param3=val3;');
 });
コード例 #11
0
 it('should return formatted params when params are present', function () {
   let params = {
     param1: 'val1',
     param2: 'val2',
     param3: 'val3'
   };
   expect(spec.formatOneMobileDynamicParams(params)).to.contain('&param1=val1&param2=val2&param3=val3');
 });
コード例 #12
0
   'if required parameterers are missed', () => {
   let bidRequest = createCustomBidRequest({
     params: {
       imp: []
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request).to.be.empty;
 });
コード例 #13
0
 it('should return url with default pageId and sizeId', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1'
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('/pubapi/3.0/9599.1/1234567/0/0/ADTECH;');
 });
コード例 #14
0
 it('should return One Mobile url with different host when host option is present', function () {
   let bidParams = Object.assign({
     host: 'qa-hb.nexage.com'
   }, getNexageGetBidParams());
   let bidRequest = createCustomBidRequest({
     params: bidParams
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('qa-hb.nexage.com/bidRequest?');
 });
コード例 #15
0
   'when only Marketplace params are present', () => {
   let bidRequest = createCustomBidRequest({
     bids: [{
       bidder: 'onemobile'
     }],
     params: getMarketplaceBidParams()
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request).to.be.empty;
 });
コード例 #16
0
      it('should return request for Marketplace via onedisplay bidder code', function () {
        let bidRequest = createCustomBidRequest({
          bids: [{
            bidder: 'onedisplay'
          }],
          params: getMarketplaceBidParams()
        });

        let [request] = spec.buildRequests(bidRequest.bids);
        expect(request.url).to.contain(MARKETPLACE_URL);
      });
コード例 #17
0
 it('should return Marketplace URL for eu region when server option is present', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1',
       server: 'adserver-eu.adtech.advertising.com'
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('adserver-eu.adtech.advertising.com/pubapi/3.0/');
 });
コード例 #18
0
 it('should return default Marketplace URL in case of unknown region config option', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1',
       region: 'an'
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain(MARKETPLACE_URL);
 });
コード例 #19
0
 it('should return url with custom alias if it is present', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1',
       alias: 'desktop_articlepage_something_box_300_250'
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('alias=desktop_articlepage_something_box_300_250');
 });
コード例 #20
0
   'when One Mobile GET and Marketplace params are present', () => {
   let bidParams = Object.assign(getNexageGetBidParams(), getMarketplaceBidParams());
   let bidRequest = createCustomBidRequest({
     bids: [{
       bidder: 'onemobile'
     }],
     params: bidParams
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain(NEXAGE_URL);
 });
コード例 #21
0
 it('should return url with bidFloor option if it is present', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1',
       bidFloor: 0.80
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('bidfloor=0.8');
 });
コード例 #22
0
        'Marketplace and One Mobile GET + POST params are present', () => {
        let bidParams = Object.assign(getMarketplaceBidParams(), getNexageGetBidParams(), getNexagePostBidParams());
        let bidRequest = createCustomBidRequest({
          bids: [{
            bidder: 'onedisplay'
          }],
          params: bidParams
        });

        let [request] = spec.buildRequests(bidRequest.bids);
        expect(request.url).to.contain(MARKETPLACE_URL);
      });
コード例 #23
0
        'when only One Mobile params are present', () => {
        let bidParams = Object.assign(getNexageGetBidParams(), getNexagePostBidParams());
        let bidRequest = createCustomBidRequest({
          bids: [{
            bidder: 'onedisplay'
          }],
          params: bidParams
        });

        let [request] = spec.buildRequests(bidRequest.bids);
        expect(request).to.be.empty;
      });
コード例 #24
0
 it('should return url with custom pageId and sizeId when options are present', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1',
       pageId: 1111,
       sizeId: 2222
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('/pubapi/3.0/9599.1/1234567/1111/2222/ADTECH;');
 });
コード例 #25
0
    it('should return formatted bid response including pixels', () => {
      bidResponse.body.ext = {
        pixels: '<script>document.write(\'<img src="pixel.gif">\');</script>'
      };

      let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest);

      expect(formattedBidResponse.ad).to.equal(
        '<script>logInfo(\'ad\');</script>' +
        '<script>if(!parent.$$PREBID_GLOBAL$$.aolGlobals.pixelsDropped){' +
        'parent.$$PREBID_GLOBAL$$.aolGlobals.pixelsDropped=true;' +
        'document.write(\'<img src="pixel.gif">\');}</script>'
      );
    });
コード例 #26
0
 it('should return url with key values if keyValues param is present', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       placement: 1234567,
       network: '9599.1',
       keyValues: {
         age: 25,
         height: 3.42,
         test: 'key'
       }
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('kvage=25;kvheight=3.42;kvtest=key');
 });
コード例 #27
0
 it('should return formatted bid response with required properties', () => {
   let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest);
   expect(formattedBidResponse).to.deep.equal({
     bidderCode: bidRequest.bidderCode,
     requestId: 'bid-id',
     ad: '<script>logInfo(\'ad\');</script>',
     cpm: 0.09,
     width: 728,
     height: 90,
     creativeId: 'creative-id',
     pubapiId: '245730051428950632',
     currency: 'USD',
     dealId: 'deal-id',
     netRevenue: true,
     ttl: 300
   });
 });
コード例 #28
0
      it('should return request object for One Mobile POST endpoint when POST configuration is present', () => {
        let bidConfig = getNexagePostBidParams();
        let bidRequest = createCustomBidRequest({
          params: bidConfig
        });

        let [request] = spec.buildRequests(bidRequest.bids);
        expect(request.url).to.contain(NEXAGE_URL);
        expect(request.method).to.equal('POST');
        expect(request.data).to.deep.equal(bidConfig);
        expect(request.options).to.deep.equal({
          contentType: 'application/json',
          customHeaders: {
            'x-openrtb-version': '2.2'
          }
        });
      });
コード例 #29
0
 it('should return formatted bid response with required properties', function () {
   let formattedBidResponse = spec.interpretResponse(bidResponse, bidRequest);
   expect(formattedBidResponse).to.deep.equal({
     bidderCode: bidRequest.bidderCode,
     requestId: 'bid-id',
     ad: DEFAULT_AD_CONTENT,
     cpm: 0.09,
     width: 728,
     height: 90,
     creativeId: 'creative-id',
     pubapiId: '245730051428950632',
     currency: 'USD',
     dealId: 'deal-id',
     netRevenue: true,
     ttl: bidRequest.ttl
   });
 });
コード例 #30
0
 it('should return One Mobile url with generic params if ext option is present', function () {
   let bidRequest = createCustomBidRequest({
     params: {
       dcn: '54321123',
       pos: 'footer-2324',
       ext: {
         param1: 'val1',
         param2: 'val2',
         param3: 'val3',
         param4: 'val4'
       }
     }
   });
   let [request] = spec.buildRequests(bidRequest.bids);
   expect(request.url).to.contain('hb.nexage.com/bidRequest?dcn=54321123&pos=footer-2324&cmd=bid' +
     '&param1=val1&param2=val2&param3=val3&param4=val4');
 });