forked from indexexchange/nano-interactive-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnano-interactive-htb-system-tests.js
128 lines (115 loc) · 3.02 KB
/
nano-interactive-htb-system-tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
'use strict';
function getPartnerId() {
return 'NanoInteractiveHtb';
}
function getStatsId() {
return 'NANO';
}
function getCallbackType() {
return 'NONE';
}
function getArchitecture() {
return 'SRA';
}
function getConfig() {
return {
publisherId: '12345',
xSlots: {
1: {
sizes: ['300x250'],
pid: '58bfec94eb0a1916fa380163',
nq: 'header bidding'
},
2: {
sizes: ['300x600'],
pid: '58bfec94eb0a1916fa380163',
nq: 'testing'
}
}
};
}
function getBidRequestRegex() {
return {
method: 'POST',
urlRegex: /.*\.audiencemanager\.de\/hb.*/
};
}
function validateBidRequest(request) {
expect(request.host).toBe('ad.audiencemanager.de');
}
function getValidResponse(request, creative) {
var response = [
{
id: '1',
bidderCode: 'nanointeractive',
cpm: 0.15,
width: 300,
height: 250,
ad: creative || '<div id="nano1"></div>',
ttl: 360,
creativeId: '6615ccc6185d77bc038c470e807f9b39',
netRevenue: false,
currency: 'EUR'
},
{
id: '2',
bidderCode: 'nanointeractive',
cpm: 2,
width: 300,
height: 600,
ad: creative || '<div id="nano2"></div>',
ttl: 360,
creativeId: 'b4be30748bdf9227b032bc71bda8f577',
netRevenue: false,
currency: 'EUR'
}
];
return JSON.stringify(response);
}
function validateTargeting(targetingMap) {
expect(targetingMap).toEqual(jasmine.objectContaining({
ix_nano_cpm: jasmine.arrayContaining(['300x250_15', '300x600_200']),
ix_nano_id: jasmine.arrayContaining([jasmine.any(String)])
}));
}
function getPassResponse() {
var response = [
{
id: '1',
bidderCode: 'nanointeractive',
cpm: 0,
width: 300,
height: 250,
ad: '<div id="nano1"></div>',
ttl: 360,
creativeId: '6615ccc6185d77bc038c470e807f9b39',
netRevenue: false,
currency: 'EUR'
},
{
id: '2',
bidderCode: 'nanointeractive',
cpm: 0,
width: 300,
height: 600,
ad: '<div id="nano2"></div>',
ttl: 360,
creativeId: 'b4be30748bdf9227b032bc71bda8f577',
netRevenue: false,
currency: 'EUR'
}
];
return JSON.stringify(response);
}
module.exports = {
getPartnerId: getPartnerId,
getStatsId: getStatsId,
getCallbackType: getCallbackType,
getArchitecture: getArchitecture,
getConfig: getConfig,
getBidRequestRegex: getBidRequestRegex,
validateBidRequest: validateBidRequest,
getValidResponse: getValidResponse,
validateTargeting: validateTargeting,
getPassResponse: getPassResponse
};