• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

prebid / Prebid.js / 18594521186

17 Oct 2025 01:40PM UTC coverage: 96.238% (-0.001%) from 96.239%
18594521186

push

github

web-flow
Semantiq RTD module: fix incorrect property name (#14027)

Co-authored-by: Alexandr Kim <alexandr.kim@audienzz.ch>

52437 of 64151 branches covered (81.74%)

1 of 1 new or added line in 1 file covered. (100.0%)

401 existing lines in 53 files now uncovered.

200307 of 208138 relevant lines covered (96.24%)

125.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.27
/modules/codefuelBidAdapter.js
1
import {isArray, setOnAny} from '../src/utils.js';
1✔
2
import {registerBidder} from '../src/adapters/bidderFactory.js';
3
import {BANNER} from '../src/mediaTypes.js';
4

5
/**
6
 * @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
7
 * @typedef {import('../src/adapters/bidderFactory.js').Bid} Bid
8
 * @typedef {import('../src/adapters/bidderFactory.js').validBidRequests} validBidRequests
9
 * @typedef {import('../src/adapters/bidderFactory.js').ServerResponse} ServerResponse
10
 * @typedef {import('../src/adapters/bidderFactory.js').SyncOptions} SyncOptions
11
 * @typedef {import('../src/adapters/bidderFactory.js').UserSync} UserSync
12
 */
13

14
const BIDDER_CODE = 'codefuel';
1✔
15
const CURRENCY = 'USD';
1✔
16

17
export const spec = {
1✔
18
  code: BIDDER_CODE,
19
  supportedMediaTypes: [ BANNER ],
20
  aliases: ['ex'], // short code
21
  /**
22
   * Determines whether or not the given bid request is valid.
23
   *
24
   * @param {BidRequest} bid The bid params to validate.
25
   * @return boolean True if this is a valid bid, and false otherwise.
26
   */
27
  isBidRequestValid: function(bid) {
28
    if (bid.nativeParams) {
5✔
29
      return false;
3✔
30
    }
31
    return !!(bid.params.placementId || (bid.params.member && bid.params.invCode));
2!
32
  },
33
  /**
34
   * Make a server request from the list of BidRequests.
35
   *
36
   * @param {validBidRequests} validBidRequests - an array of bids
37
   * @return ServerRequest Info describing the request to the server.
38
   */
39
  buildRequests: function(validBidRequests, bidderRequest) {
40
    const page = bidderRequest.refererInfo.page;
2✔
41
    const domain = bidderRequest.refererInfo.domain;
2✔
42
    const ua = navigator.userAgent;
2✔
43
    const devicetype = getDeviceType()
2✔
44
    const publisher = setOnAny(validBidRequests, 'params.publisher');
2✔
45
    const cur = CURRENCY;
2✔
46
    const endpointUrl = 'https://ai-p-codefuel-ds-rtb-us-east-1-k8s.seccint.com/prebid'
2✔
47
    const timeout = bidderRequest.timeout;
2✔
48

49
    validBidRequests.forEach(bid => {
2✔
50
      bid.netRevenue = 'net';
2✔
51
    });
52

53
    const imps = validBidRequests.map((bid, idx) => {
2✔
54
      const imp = {
2✔
55
        id: idx + 1 + ''
56
      }
57

58
      if (bid.params.tagid) {
2!
59
        imp.tagid = bid.params.tagid
×
60
      }
61

62
      if (bid.sizes) {
2✔
63
        imp.banner = {
1✔
64
          format: transformSizes(bid.sizes)
65
        }
66
      }
67

68
      return imp;
2✔
69
    });
70

71
    const request = {
2✔
72
      id: bidderRequest.bidderRequestId,
73
      site: { page, domain, publisher },
74
      device: { ua, devicetype },
75
      source: { fd: 1 },
76
      cur: [cur],
77
      tmax: timeout,
78
      imp: imps,
79
    };
80

81
    return {
2✔
82
      method: 'POST',
83
      url: endpointUrl,
84
      data: request,
85
      bids: validBidRequests,
86
      options: {
87
        withCredentials: false
88
      }
89
    };
90
  },
91
  /**
92
   * Unpack the response from the server into a list of bids.
93
   *
94
   * @param {ServerResponse} serverResponse A successful response from the server.
95
   * @return {Bid[]} An array of bids which were nested inside the server.
96
   */
97
  interpretResponse: (serverResponse, { bids }) => {
2✔
98
    if (!serverResponse.body) {
2✔
99
      return [];
1✔
100
    }
101
    const { seatbid, cur } = serverResponse.body;
1✔
102

103
    const bidResponses = flatten(seatbid.map(seat => seat.bid)).reduce((result, bid) => {
1✔
104
      result[bid.impid - 1] = bid;
1✔
105
      return result;
1✔
106
    }, []);
107

108
    return bids.map((bid, id) => {
1✔
109
      const bidResponse = bidResponses[id];
1✔
110
      if (bidResponse) {
1✔
111
        const bidObject = {
1✔
112
          requestId: bid.bidId,
113
          cpm: bidResponse.price,
114
          creativeId: bidResponse.crid,
115
          ttl: 360,
116
          netRevenue: true,
117
          currency: cur,
118
          mediaType: BANNER,
119
          ad: bidResponse.adm,
120
          width: bidResponse.w,
121
          height: bidResponse.h,
122
          meta: { advertiserDomains: bid.adomain ? bid.adomain : [] }
1!
123
        };
124
        return bidObject;
1✔
125
      }
UNCOV
126
      return undefined;
×
127
    }).filter(Boolean);
128
  },
129

130
  /**
131
   * Register the user sync pixels which should be dropped after the auction.
132
   *
133
   * @param {SyncOptions} syncOptions Which user syncs are allowed?
134
   * @param {ServerResponse[]} serverResponses List of server's responses.
135
   * @return {UserSync[]} The user syncs which should be dropped.
136
   */
137
  getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
138
    return [];
8✔
139
  }
140

141
}
142
registerBidder(spec);
1✔
143

144
function getDeviceType() {
145
  if ((/ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase()))) {
2!
UNCOV
146
    return 5; // 'tablet'
×
147
  }
148
  if ((/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(navigator.userAgent.toLowerCase()))) {
2!
UNCOV
149
    return 4; // 'mobile'
×
150
  }
151
  return 2; // 'desktop'
2✔
152
}
153

154
function flatten(arr) {
155
  return [].concat(...arr);
1✔
156
}
157

158
/* Turn bid request sizes into ut-compatible format */
159
function transformSizes(requestSizes) {
160
  if (!isArray(requestSizes)) {
1!
UNCOV
161
    return [];
×
162
  }
163

164
  if (requestSizes.length === 2 && !isArray(requestSizes[0])) {
1!
UNCOV
165
    return [{
×
166
      w: parseInt(requestSizes[0], 10),
167
      h: parseInt(requestSizes[1], 10)
168
    }];
169
  } else if (isArray(requestSizes[0])) {
1✔
170
    return requestSizes.map(item =>
1✔
171
      ({
1✔
172
        w: parseInt(item[0], 10),
173
        h: parseInt(item[1], 10)
174
      })
175
    );
176
  }
177

UNCOV
178
  return [];
×
179
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc