This repository has been archived by the owner on May 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeachfront-htb-system-tests.js
100 lines (87 loc) · 2.23 KB
/
beachfront-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
'use strict';
function getPartnerId() {
return 'BeachfrontHtb';
}
function getStatsId() {
return 'BFT';
}
function getCallbackType() {
return 'NONE';
}
function getArchitecture() {
return 'SRA';
}
function getConfig() {
return {
xSlots: {
1: {
appId: '3b16770b-17af-4d22-daff-9606bdf2c9c3',
bidfloor: 0.01,
sizes: [[728, 90], [468, 60]]
},
2: {
appId: '3b16770b-17af-4d22-daff-9606bdf2c9c3',
bidfloor: 0.02,
sizes: [[300, 250]]
}
}
};
}
function getBidRequestRegex() {
return {
method: 'POST',
urlRegex: /display\.bfmio\.com\/prebid_display/
};
}
function validateBidRequest(request) {
expect(request.query.cb).toBeDefined();
}
function getValidResponse(request, creative) {
var response = [
{
slot: '1',
w: 728,
h: 90,
price: 2.00,
crid: 'crid_1',
adm: creative || '<div id="1"></div>'
},
{
slot: '2',
w: 300,
h: 250,
price: 2.00,
crid: 'crid_2',
adm: creative || '<div id="2"></div>'
}
];
return JSON.stringify(response);
}
function validateTargeting(targetingMap) {
expect(targetingMap).toEqual(
jasmine.objectContaining({
ix_bft_cpm: jasmine.arrayWithExactContents(['728x90_200', '300x250_200']),
ix_bft_id: jasmine.arrayWithExactContents([jasmine.any(String), jasmine.any(String)])
})
);
}
function getPassResponse() {
var response = [
{
sync: '//sync.bfmio.com/sync_iframe?ifpl=5&ifg=1&id=example&gdpr=1&gc=GDPR_CONSENT_STRING&gce=1&cb=123'
}
];
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
};