From 0f71aad0b5e905aeb1262fd16d70da743e92728c Mon Sep 17 00:00:00 2001 From: Albert Bentov Date: Wed, 8 Oct 2025 10:43:05 +0300 Subject: [PATCH 1/6] STAGE::prebidjs + docs --- modules/tezaBidAdapter.js | 136 ++++++++++++++++++++ modules/tezaBidAdapter.md | 15 +++ test/spec/modules/tezaBidAdapter_spec.js | 154 +++++++++++++++++++++++ 3 files changed, 305 insertions(+) create mode 100644 modules/tezaBidAdapter.js create mode 100644 modules/tezaBidAdapter.md create mode 100644 test/spec/modules/tezaBidAdapter_spec.js diff --git a/modules/tezaBidAdapter.js b/modules/tezaBidAdapter.js new file mode 100644 index 00000000000..83580b35d7b --- /dev/null +++ b/modules/tezaBidAdapter.js @@ -0,0 +1,136 @@ +// modules/tezaBidAdapter.js +// Minimal banner-only adapter for OpenRTB 2.x endpoint +// npm i -g gulp-cli # one time command +// npm ci # one time command +// Build: +// `gulp build --modules=tezaBidAdapter` +// Compiled output: ./build/dist/prebid.js + +// modules/tezaBidAdapter.js +import { registerBidder } from '../src/adapters/bidderFactory.js'; +import { BANNER } from '../src/mediaTypes.js'; +import { config } from '../src/config.js'; + +const BIDDER_CODE = 'teza'; +const ENDPOINT = '/teza-auction'; + +function sizesToFormat(sizes) { + return (sizes || []).map(s => ({ w: s[0], h: s[1] })); +} + +export const spec = { + code: BIDDER_CODE, + supportedMediaTypes: [BANNER], + + isBidRequestValid(bid) { + return !!(bid?.params?.tagid && bid?.params?.account); + }, + + buildRequests(validBidRequests, bidderRequest) { + if (!validBidRequests?.length) return []; + + const b0 = validBidRequests[0]; + const account = b0.params.account; + const test = b0.params.test ? 1 : 1; + + const ortb2 = bidderRequest?.ortb2 || config.getConfig('ortb2') || {}; + const eids = b0.userIdAsEids || []; + const schain = b0.schain || null; + const ri = bidderRequest?.refererInfo || {}; + + const imps = validBidRequests.map(bid => { + const sizes = bid.mediaTypes?.banner?.sizes || bid.sizes || []; + return { + id: bid.bidId, + tagid: bid.params.tagid, + secure: 1, + banner: { format: sizesToFormat(sizes) }, + bidfloor: bid.params.bidfloor || 0.01, + bidfloorcur: bid.params.bidfloorcur || 'USD' + }; + }); + + const regs = { + coppa: bidderRequest?.coppa ? 1 : 0, + ext: { + gdpr: bidderRequest?.gdprConsent?.gdprApplies ? 1 : 0, + us_privacy: bidderRequest?.uspConsent || undefined + }, + gpp: bidderRequest?.gppConsent?.gppString, + gpp_sid: bidderRequest?.gppConsent?.applicableSections + }; + + const user = { + ...ortb2.user, + ext: { + ...(ortb2.user?.ext || {}), + consent: bidderRequest?.gdprConsent?.consentString, + eids + } + }; + + const device = { + ...ortb2.device, + ua: (typeof navigator !== 'undefined' ? navigator.userAgent : ''), + language: (typeof navigator !== 'undefined' ? navigator.language : undefined), + dnt: (typeof navigator !== 'undefined' && navigator.doNotTrack === '1') ? 1 : 0 + }; + + const ortb = { + id: bidderRequest?.auctionId || String(Date.now()), + imp: imps, + at: 1, + tmax: bidderRequest?.timeout || 1000, + cur: ['USD'], + test, + site: { + ...ortb2.site, + domain: ri.domain || (typeof location !== 'undefined' ? location.hostname : ''), + page: ri.page || (typeof location !== 'undefined' ? location.href : '') + }, + device, + user, + regs, + source: schain ? { ext: { schain } } : undefined + }; + + const url = `${ENDPOINT}?test=${test}&account=${encodeURIComponent(account)}`; + return { method: 'POST', url, data: ortb }; + }, + + interpretResponse(serverResponse) { + const res = serverResponse?.body || {}; + const cur = Array.isArray(res.cur) ? (res.cur[0] || 'USD') : (res.cur || 'USD'); + const out = []; + + (res.seatbid || []).forEach(sb => { + (sb.bid || []).forEach(b => { + out.push({ + requestId: b.impid, + cpm: b.price || 0, + currency: cur, + width: b.w, + height: b.h, + creativeId: b.crid || b.id || 'teza-crid', + ttl: 30, + netRevenue: true, + ad: b.adm, + nurl: b.nurl, + burl: b.burl, + meta: { advertiserDomains: b.adomain || [] } + }); + }); + }); + + return out; + }, + + getUserSyncs() { return []; }, + + onBidWon(bid) { + const url = (bid.burl || bid.nurl || '').replace(/\$\{AUCTION_PRICE\}/g, String(bid.cpm)); + if (url) { new Image().src = url; } + } +}; + +registerBidder(spec); diff --git a/modules/tezaBidAdapter.md b/modules/tezaBidAdapter.md new file mode 100644 index 00000000000..eedda4e79de --- /dev/null +++ b/modules/tezaBidAdapter.md @@ -0,0 +1,15 @@ +# Test Parameters +```js +var adUnits = [{ + code: 'div-1', + mediaTypes: { banner: { sizes: [[300,250]] } }, + bids: [{ + bidder: 'teza', + params: { + tagid: 'atagid', + token: '76iagB4iWzsyJqKP5dIOHRj_U6Q9knJdUCYexUEqHNk', + test: true + } + }] +}]; + diff --git a/test/spec/modules/tezaBidAdapter_spec.js b/test/spec/modules/tezaBidAdapter_spec.js new file mode 100644 index 00000000000..ac6d3a9f774 --- /dev/null +++ b/test/spec/modules/tezaBidAdapter_spec.js @@ -0,0 +1,154 @@ +// test/spec/modules/tezaBidAdapter_spec.js +import { expect } from 'chai'; +import { spec } from 'modules/tezaBidAdapter.js'; + +describe('tezaBidAdapter', function () { + const bidderRequest = { + auctionId: 'auc-1', + timeout: 1200, + refererInfo: { domain: 'localhost', page: 'http://localhost/test-teza.html' }, + gdprConsent: { gdprApplies: true, consentString: 'CONSENT' }, + uspConsent: '1YNN', + gppConsent: { gppString: 'GPPSTRING', applicableSections: [7] }, + ortb2: { user: { buyeruid: 'u1' }, device: { dnt: 0 }, site: { cat: ['IAB1'] } } + }; + + const validBid = { + bidder: 'teza', + bidId: 'bid-1', + adUnitCode: 'div-1', + params: { tagid: 'atagid', account: 'acct123', test: true }, + schain: { ver: '1.0', complete: 1, nodes: [] }, + userIdAsEids: [{ source: 'uid.example', uids: [{ id: 'abc' }] }], + mediaTypes: { banner: { sizes: [[300, 250], [320, 50]] } } + }; + + describe('isBidRequestValid', () => { + it('returns true when tagid and account exist', () => { + expect(spec.isBidRequestValid(validBid)).to.equal(true); + }); + it('returns false when missing account', () => { + const b = { ...validBid, params: { tagid: 'atagid' } }; + expect(spec.isBidRequestValid(b)).to.equal(false); + }); + }); + + describe('buildRequests', () => { + it('builds POST with account & test on query and expected ORTB fields', () => { + const req = spec.buildRequests([validBid], bidderRequest); + expect(req.method).to.equal('POST'); + expect(req.url).to.match(/^\/teza-auction\?test=1&account=acct123$/); + expect(req.data).to.be.an('object'); + + const ortb = req.data; + expect(ortb.id).to.equal('auc-1'); + expect(ortb.cur).to.deep.equal(['USD']); + expect(ortb.test).to.equal(1); + + // site + expect(ortb.site.domain).to.equal('localhost'); + expect(ortb.site.page).to.match(/http:\/\/localhost\/test-teza\.html/); + + // imp + expect(ortb.imp).to.have.length(1); + expect(ortb.imp[0].tagid).to.equal('atagid'); + expect(ortb.imp[0].banner.format).to.deep.equal([{ w: 300, h: 250 }, { w: 320, h: 50 }]); + + // user/device/regs + expect(ortb.device).to.be.an('object'); + expect(ortb.user.ext.consent).to.equal('CONSENT'); + expect(ortb.user.ext.eids).to.be.an('array').with.length(1); + expect(ortb.regs.ext.gdpr).to.equal(1); + expect(ortb.regs.ext.us_privacy).to.equal('1YNN'); + expect(ortb.regs.gpp).to.equal('GPPSTRING'); + expect(ortb.regs.gpp_sid).to.deep.equal([7]); + + // schain + expect(ortb.source.ext.schain).to.be.an('object'); + }); + }); + + describe('interpretResponse', () => { + it('maps OpenRTB seatbid to Prebid bids', () => { + const serverResponse = { + body: { + id: 'resp-1', + cur: 'USD', + seatbid: [{ + seat: 'teza', + bid: [{ + id: 'b1', + impid: 'bid-1', + price: 0.5, + w: 300, + h: 250, + crid: 'cr1', + adm: '
ad
', + adomain: ['example.com'], + nurl: 'https://dsp/win?price=${AUCTION_PRICE}', + burl: 'https://dsp/beacon?price=${AUCTION_PRICE}' + }] + }] + } + }; + const out = spec.interpretResponse(serverResponse, {}); + expect(out).to.have.length(1); + const b = out[0]; + expect(b.requestId).to.equal('bid-1'); + expect(b.cpm).to.equal(0.5); + expect(b.width).to.equal(300); + expect(b.height).to.equal(250); + expect(b.creativeId).to.equal('cr1'); + expect(b.ad).to.match(/
ad<\/div>/); + expect(b.meta.advertiserDomains).to.deep.equal(['example.com']); + expect(b.nurl).to.be.a('string'); + expect(b.burl).to.be.a('string'); + }); + }); + + describe('onBidWon', () => { + let OriginalImage; + let fired; + + beforeEach(() => { + fired = []; + OriginalImage = global.Image; + + // Mock with getter+setter to satisfy eslint accessor-pairs + global.Image = class { + constructor() { this._src = ''; } + get src() { return this._src; } + set src(url) { this._src = url; fired.push(url); } + }; + }); + + afterEach(() => { global.Image = OriginalImage; }); + + it('pings burl (falls back to nurl) with cleared AUCTION_PRICE macro', () => { + const bid = { burl: 'https://dsp/beacon?price=${AUCTION_PRICE}', nurl: 'https://dsp/win?price=${AUCTION_PRICE}', cpm: 1.23 }; + spec.onBidWon(bid); + expect(fired).to.have.length(1); + expect(fired[0]).to.equal('https://dsp/beacon?price=1.23'); + }); + + it('uses nurl when burl absent', () => { + const bid = { nurl: 'https://dsp/win?price=${AUCTION_PRICE}', cpm: 0.5 }; + spec.onBidWon(bid); + expect(fired[0]).to.equal('https://dsp/win?price=0.5'); + }); + + it('does nothing when neither url is present', () => { + const bid = { cpm: 0.5 }; + spec.onBidWon(bid); + expect(fired).to.have.length(0); + }); + + describe('alias', () => { + it('works under alias', () => { + const vb = { ...validBid, bidder: 'tezaAlias' }; // reuse scoped validBid + const req = spec.buildRequests([vb], bidderRequest); + expect(req.url).to.match(/\/teza-auction\?test=1&account=acct123$/); + }); + }); + }); +}); From 936d7c30b3d83f720e5be1bef766e2346393efd9 Mon Sep 17 00:00:00 2001 From: Albert Bentov Date: Sun, 12 Oct 2025 10:27:08 +0300 Subject: [PATCH 2/6] STAGE::prebidjs + docs --- modules/tezaBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tezaBidAdapter.js b/modules/tezaBidAdapter.js index 83580b35d7b..449557cf404 100644 --- a/modules/tezaBidAdapter.js +++ b/modules/tezaBidAdapter.js @@ -12,7 +12,7 @@ import { BANNER } from '../src/mediaTypes.js'; import { config } from '../src/config.js'; const BIDDER_CODE = 'teza'; -const ENDPOINT = '/teza-auction'; +const ENDPOINT = 'https://dsp-us-east-1-nyc.tezatags.com/openrtb2/auction'; function sizesToFormat(sizes) { return (sizes || []).map(s => ({ w: s[0], h: s[1] })); From 0896359e8fb321cd9248de4557c09d518dcca89e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 14:21:00 +0000 Subject: [PATCH 3/6] Fix PR review comments: test default, AUCTION_PRICE macro, and optional tagid - Fix test parameter to default to 0 (false) instead of 1 - Fix AUCTION_PRICE macro regex by removing dollar sign - Make tagid optional in isBidRequestValid (only require account) - Add fallback logic to check tagid in ortb2Imp.tagid and ortb2Imp.ext.gpid Co-Authored-By: vadim@teza.ai --- modules/tezaBidAdapter.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/tezaBidAdapter.js b/modules/tezaBidAdapter.js index 449557cf404..4d202ab7c83 100644 --- a/modules/tezaBidAdapter.js +++ b/modules/tezaBidAdapter.js @@ -23,7 +23,7 @@ export const spec = { supportedMediaTypes: [BANNER], isBidRequestValid(bid) { - return !!(bid?.params?.tagid && bid?.params?.account); + return !!(bid?.params?.account); }, buildRequests(validBidRequests, bidderRequest) { @@ -31,7 +31,7 @@ export const spec = { const b0 = validBidRequests[0]; const account = b0.params.account; - const test = b0.params.test ? 1 : 1; + const test = b0.params.test ? 1 : 0; const ortb2 = bidderRequest?.ortb2 || config.getConfig('ortb2') || {}; const eids = b0.userIdAsEids || []; @@ -40,9 +40,10 @@ export const spec = { const imps = validBidRequests.map(bid => { const sizes = bid.mediaTypes?.banner?.sizes || bid.sizes || []; + const tagid = bid.params.tagid || bid.ortb2Imp?.tagid || bid.ortb2Imp?.ext?.gpid; return { id: bid.bidId, - tagid: bid.params.tagid, + tagid: tagid, secure: 1, banner: { format: sizesToFormat(sizes) }, bidfloor: bid.params.bidfloor || 0.01, @@ -128,7 +129,7 @@ export const spec = { getUserSyncs() { return []; }, onBidWon(bid) { - const url = (bid.burl || bid.nurl || '').replace(/\$\{AUCTION_PRICE\}/g, String(bid.cpm)); + const url = (bid.burl || bid.nurl || '').replace(/\{AUCTION_PRICE\}/g, String(bid.cpm)); if (url) { new Image().src = url; } } }; From 8cba4249d4406e2ec66cff3c9fbb2791b7a3ff5c Mon Sep 17 00:00:00 2001 From: vadim-frolov Date: Mon, 3 Nov 2025 15:56:16 +0100 Subject: [PATCH 4/6] fixed regex --- modules/tezaBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tezaBidAdapter.js b/modules/tezaBidAdapter.js index 4d202ab7c83..d24ea555f52 100644 --- a/modules/tezaBidAdapter.js +++ b/modules/tezaBidAdapter.js @@ -129,7 +129,7 @@ export const spec = { getUserSyncs() { return []; }, onBidWon(bid) { - const url = (bid.burl || bid.nurl || '').replace(/\{AUCTION_PRICE\}/g, String(bid.cpm)); + const url = (bid.burl || bid.nurl || '').replace(/\$\{AUCTION_PRICE\}/g, String(bid.cpm)); if (url) { new Image().src = url; } } }; From 117654d559c15dc97717d48ed96e22a58ff25e81 Mon Sep 17 00:00:00 2001 From: vadim-frolov Date: Mon, 3 Nov 2025 16:13:15 +0100 Subject: [PATCH 5/6] fixed url encoding --- modules/tezaBidAdapter.js | 13 ++++++++++--- modules/tezaBidAdapter.md | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/tezaBidAdapter.js b/modules/tezaBidAdapter.js index d24ea555f52..20794702759 100644 --- a/modules/tezaBidAdapter.js +++ b/modules/tezaBidAdapter.js @@ -40,7 +40,7 @@ export const spec = { const imps = validBidRequests.map(bid => { const sizes = bid.mediaTypes?.banner?.sizes || bid.sizes || []; - const tagid = bid.params.tagid || bid.ortb2Imp?.tagid || bid.ortb2Imp?.ext?.gpid; + const tagid = bid.params.tagid || bid.ortb2Imp?.tagid || bid.ortb2Imp?.ext?.gpid || bid.adUnitCode; return { id: bid.bidId, tagid: tagid, @@ -129,8 +129,15 @@ export const spec = { getUserSyncs() { return []; }, onBidWon(bid) { - const url = (bid.burl || bid.nurl || '').replace(/\$\{AUCTION_PRICE\}/g, String(bid.cpm)); - if (url) { new Image().src = url; } + let url = bid.burl || bid.nurl || ''; + if (!url) return; + + try { + url = decodeURIComponent(url); + } catch { /* ignore malformed encodings */ } + + url = url.replace(/\$\{AUCTION_PRICE\}/g, String(bid.cpm)); + new Image().src = url; } }; diff --git a/modules/tezaBidAdapter.md b/modules/tezaBidAdapter.md index eedda4e79de..2f9a3482bde 100644 --- a/modules/tezaBidAdapter.md +++ b/modules/tezaBidAdapter.md @@ -6,7 +6,6 @@ var adUnits = [{ bids: [{ bidder: 'teza', params: { - tagid: 'atagid', token: '76iagB4iWzsyJqKP5dIOHRj_U6Q9knJdUCYexUEqHNk', test: true } From b1a3b5e6e688310623b3a58bd4cc92cf7a809cb6 Mon Sep 17 00:00:00 2001 From: vadim-frolov Date: Tue, 4 Nov 2025 12:02:24 +0100 Subject: [PATCH 6/6] fixed unit tests --- modules/tezaBidAdapter.md | 51 +++++++--- test/spec/modules/tezaBidAdapter_spec.js | 118 +++++++++++++++-------- 2 files changed, 116 insertions(+), 53 deletions(-) diff --git a/modules/tezaBidAdapter.md b/modules/tezaBidAdapter.md index 2f9a3482bde..556285828da 100644 --- a/modules/tezaBidAdapter.md +++ b/modules/tezaBidAdapter.md @@ -1,14 +1,41 @@ +# Overview + +``` +Module Name: Teza Bidder Adapter +Module Type: Bidder Adapter +``` + +# Description + +Minimal banner-only adapter for an OpenRTB 2.x endpoint. + +### Bid params + +| Name | Scope | Description | Example | Type | +| ------------- | -------- | --------------------------------------------------------------------------- | ---------- | --------- | +| `account` | required | Account identifier provided by Teza. | `acct123` | `string` | +| `tagid` | optional | Ad placement identifier; falls back to GPID or `adUnitCode` if not present. | `home-top` | `string` | +| `bidfloor` | optional | Minimum price to bid. Default `0.01`. | `0.10` | `number` | +| `bidfloorcur` | optional | Currency for `bidfloor`. Default `USD`. | `USD` | `string` | +| `test` | optional | When `true`, enables test mode (`test=1`) on requests. | `true` | `boolean` | + # Test Parameters -```js -var adUnits = [{ - code: 'div-1', - mediaTypes: { banner: { sizes: [[300,250]] } }, - bids: [{ - bidder: 'teza', - params: { - token: '76iagB4iWzsyJqKP5dIOHRj_U6Q9knJdUCYexUEqHNk', - test: true - } - }] -}]; +```js +var adUnits = [ + { + code: "div-1", + mediaTypes: { banner: { sizes: [[300, 250]] } }, + bids: [ + { + bidder: "teza", + params: { + account: "acct123", + bidfloor: 0.1, + test: true, + }, + }, + ], + }, +]; +``` diff --git a/test/spec/modules/tezaBidAdapter_spec.js b/test/spec/modules/tezaBidAdapter_spec.js index ac6d3a9f774..2147eb0e8a5 100644 --- a/test/spec/modules/tezaBidAdapter_spec.js +++ b/test/spec/modules/tezaBidAdapter_spec.js @@ -6,11 +6,18 @@ describe('tezaBidAdapter', function () { const bidderRequest = { auctionId: 'auc-1', timeout: 1200, - refererInfo: { domain: 'localhost', page: 'http://localhost/test-teza.html' }, + refererInfo: { + domain: 'localhost', + page: 'http://localhost/test-teza.html', + }, gdprConsent: { gdprApplies: true, consentString: 'CONSENT' }, uspConsent: '1YNN', gppConsent: { gppString: 'GPPSTRING', applicableSections: [7] }, - ortb2: { user: { buyeruid: 'u1' }, device: { dnt: 0 }, site: { cat: ['IAB1'] } } + ortb2: { + user: { buyeruid: 'u1' }, + device: { dnt: 0 }, + site: { cat: ['IAB1'] }, + }, }; const validBid = { @@ -20,24 +27,33 @@ describe('tezaBidAdapter', function () { params: { tagid: 'atagid', account: 'acct123', test: true }, schain: { ver: '1.0', complete: 1, nodes: [] }, userIdAsEids: [{ source: 'uid.example', uids: [{ id: 'abc' }] }], - mediaTypes: { banner: { sizes: [[300, 250], [320, 50]] } } + mediaTypes: { + banner: { + sizes: [ + [300, 250], + [320, 50], + ], + }, + }, }; - describe('isBidRequestValid', () => { - it('returns true when tagid and account exist', () => { + describe('isBidRequestValid', function () { + it('returns true when tagid and account exist', function () { expect(spec.isBidRequestValid(validBid)).to.equal(true); }); - it('returns false when missing account', () => { + it('returns false when missing account', function () { const b = { ...validBid, params: { tagid: 'atagid' } }; expect(spec.isBidRequestValid(b)).to.equal(false); }); }); - describe('buildRequests', () => { - it('builds POST with account & test on query and expected ORTB fields', () => { + describe('buildRequests', function () { + it('builds POST with account & test on query and expected ORTB fields', function () { const req = spec.buildRequests([validBid], bidderRequest); expect(req.method).to.equal('POST'); - expect(req.url).to.match(/^\/teza-auction\?test=1&account=acct123$/); + expect(req.url).to.match( + /^https?:\/\/[^\s]+openrtb2\/auction\?test=1&account=acct123$/ + ); expect(req.data).to.be.an('object'); const ortb = req.data; @@ -52,7 +68,10 @@ describe('tezaBidAdapter', function () { // imp expect(ortb.imp).to.have.length(1); expect(ortb.imp[0].tagid).to.equal('atagid'); - expect(ortb.imp[0].banner.format).to.deep.equal([{ w: 300, h: 250 }, { w: 320, h: 50 }]); + expect(ortb.imp[0].banner.format).to.deep.equal([ + { w: 300, h: 250 }, + { w: 320, h: 50 }, + ]); // user/device/regs expect(ortb.device).to.be.an('object'); @@ -68,28 +87,32 @@ describe('tezaBidAdapter', function () { }); }); - describe('interpretResponse', () => { - it('maps OpenRTB seatbid to Prebid bids', () => { + describe('interpretResponse', function () { + it('maps OpenRTB seatbid to Prebid bids', function () { const serverResponse = { body: { id: 'resp-1', cur: 'USD', - seatbid: [{ - seat: 'teza', - bid: [{ - id: 'b1', - impid: 'bid-1', - price: 0.5, - w: 300, - h: 250, - crid: 'cr1', - adm: '
ad
', - adomain: ['example.com'], - nurl: 'https://dsp/win?price=${AUCTION_PRICE}', - burl: 'https://dsp/beacon?price=${AUCTION_PRICE}' - }] - }] - } + seatbid: [ + { + seat: 'teza', + bid: [ + { + id: 'b1', + impid: 'bid-1', + price: 0.5, + w: 300, + h: 250, + crid: 'cr1', + adm: '
ad
', + adomain: ['example.com'], + nurl: 'https://dsp/win?price=${AUCTION_PRICE}', + burl: 'https://dsp/beacon?price=${AUCTION_PRICE}', + }, + ], + }, + ], + }, }; const out = spec.interpretResponse(serverResponse, {}); expect(out).to.have.length(1); @@ -106,48 +129,61 @@ describe('tezaBidAdapter', function () { }); }); - describe('onBidWon', () => { + describe('onBidWon', function () { let OriginalImage; let fired; - beforeEach(() => { + beforeEach(function () { fired = []; OriginalImage = global.Image; // Mock with getter+setter to satisfy eslint accessor-pairs global.Image = class { - constructor() { this._src = ''; } - get src() { return this._src; } - set src(url) { this._src = url; fired.push(url); } + constructor() { + this._src = ''; + } + get src() { + return this._src; + } + set src(url) { + this._src = url; + fired.push(url); + } }; }); - afterEach(() => { global.Image = OriginalImage; }); + afterEach(function () { + global.Image = OriginalImage; + }); - it('pings burl (falls back to nurl) with cleared AUCTION_PRICE macro', () => { - const bid = { burl: 'https://dsp/beacon?price=${AUCTION_PRICE}', nurl: 'https://dsp/win?price=${AUCTION_PRICE}', cpm: 1.23 }; + it('pings burl (falls back to nurl) with cleared AUCTION_PRICE macro', function () { + const bid = { + burl: 'https://dsp/beacon?price=${AUCTION_PRICE}', + nurl: 'https://dsp/win?price=${AUCTION_PRICE}', + cpm: 1.23, + }; spec.onBidWon(bid); expect(fired).to.have.length(1); expect(fired[0]).to.equal('https://dsp/beacon?price=1.23'); }); - it('uses nurl when burl absent', () => { + it('uses nurl when burl absent', function () { const bid = { nurl: 'https://dsp/win?price=${AUCTION_PRICE}', cpm: 0.5 }; spec.onBidWon(bid); expect(fired[0]).to.equal('https://dsp/win?price=0.5'); }); - it('does nothing when neither url is present', () => { + it('does nothing when neither url is present', function () { const bid = { cpm: 0.5 }; spec.onBidWon(bid); expect(fired).to.have.length(0); }); - describe('alias', () => { - it('works under alias', () => { + describe('alias', function () { + it('works under alias', function () { const vb = { ...validBid, bidder: 'tezaAlias' }; // reuse scoped validBid const req = spec.buildRequests([vb], bidderRequest); - expect(req.url).to.match(/\/teza-auction\?test=1&account=acct123$/); + expect(req.url).to.match(/openrtb2\/auction\?test=1&account=acct123$/); }); }); });