This repository has been archived by the owner on May 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
locker-dome-htb-system-tests.js
89 lines (77 loc) · 1.96 KB
/
locker-dome-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
'use strict';
function getPartnerId() {
return 'LockerDomeHtb';
}
function getStatsId() {
return 'LKDM';
}
function getCallbackType() {
return 'NONE';
}
function getArchitecture() {
return 'FSRA';
}
function getConfig() {
return {
xSlots: {
1: {
adUnitId: '11154591702270566'
},
2: {
adUnitId: '11154591702270566'
}
}
};
}
function getBidRequestRegex() {
return {
method: 'POST',
urlRegex: /lockerdome\.com\/ladbid\/indexexchange/
};
}
function validateBidRequest(request) {
expect(request.query.cachebuster).toBeDefined();
expect(request.query.requestIds).toBeDefined();
}
function getValidResponse(request, creative) {
var requestIds = request.query.requestIds.split(',');
return JSON.stringify({
bids: [
{
requestId: requestIds[0],
cpm: 2,
width: 300,
height: 250,
ad: creative
},
{
requestId: requestIds[1],
cpm: 2,
width: 300,
height: 250,
ad: creative
}
]
});
}
function validateTargeting(targetingMap) {
expect(targetingMap).toEqual(jasmine.objectContaining({
ix_lkdm_cpm: jasmine.arrayContaining(['300x250_200', '300x250_200']),
ix_lkdm_id: jasmine.arrayContaining([jasmine.any(String), jasmine.any(String)])
}));
}
function getPassResponse() {
return JSON.stringify({ bids: [] });
}
module.exports = {
getPartnerId: getPartnerId,
getStatsId: getStatsId,
getCallbackType: getCallbackType,
getArchitecture: getArchitecture,
getConfig: getConfig,
getBidRequestRegex: getBidRequestRegex,
validateBidRequest: validateBidRequest,
getValidResponse: getValidResponse,
validateTargeting: validateTargeting,
getPassResponse: getPassResponse
};