forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_spec.js
More file actions
executable file
·97 lines (75 loc) · 3.2 KB
/
api_spec.js
File metadata and controls
executable file
·97 lines (75 loc) · 3.2 KB
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
var assert = require('chai').assert;
var prebid = require('../../src/prebid.js');
const { getGlobalVarName } = require('../../src/buildOptions.js');
const { getGlobal } = require('../../src/prebidGlobal.js');
describe('Publisher API', function () {
// var assert = chai.assert;
describe('api of command queue', function () {
it(`should have a global variable ${getGlobalVarName()}`, function () {
assert.isObject(window[getGlobalVarName()]);
});
it(`should have a global variable ${getGlobalVarName()}.cmd as an array`, function () {
assert.isArray(window[getGlobalVarName()].cmd);
});
it(`should have ${getGlobalVarName()}.cmd.push function`, function () {
assert.isFunction(window[getGlobalVarName()].cmd.push);
});
it(`should have a global variable ${getGlobalVarName()}.que as an array`, function () {
assert.isArray(window[getGlobalVarName()].que);
});
it(`should have ${getGlobalVarName()}.que.push function`, function () {
assert.isFunction(window[getGlobalVarName()].que.push);
});
it('should have global pointer for PBJS global', function () {
assert.isArray(window._pbjsGlobals);
});
});
describe('has function', function () {
it('should have requestBids.before and .after', () => {
assert.isFunction(getGlobal().requestBids.before);
assert.isFunction(getGlobal().requestBids.after);
});
it('should have function .getAdserverTargeting', function () {
assert.isFunction(getGlobal().getAdserverTargeting);
});
it('should have function .getAdserverTargetingForAdUnitCode', function () {
assert.isFunction(getGlobal().getAdserverTargetingForAdUnitCode);
});
it('should have function .getBidResponses', function () {
assert.isFunction(getGlobal().getBidResponses);
});
it('should have function .getNoBids', function () {
assert.isFunction(getGlobal().getNoBids);
});
it('should have function .getNoBidsForAdUnitCode', function () {
assert.isFunction(getGlobal().getNoBidsForAdUnitCode);
});
it('should have function .getBidResponsesForAdUnitCode', function () {
assert.isFunction(getGlobal().getBidResponsesForAdUnitCode);
});
it('should have function .setTargetingForGPTAsync', function () {
assert.isFunction(getGlobal().setTargetingForGPTAsync);
});
it('should have function .renderAd', function () {
assert.isFunction(getGlobal().renderAd);
});
it('should have function .removeAdUnit', function () {
assert.isFunction(getGlobal().removeAdUnit);
});
it('should have function .requestBids', function () {
assert.isFunction(getGlobal().requestBids);
});
it('should have function .addAdUnits', function () {
assert.isFunction(getGlobal().addAdUnits);
});
it('should have function .aliasBidder', function () {
assert.isFunction(getGlobal().aliasBidder);
});
it('should have function .getAllWinningBids', function () {
assert.isFunction(getGlobal().getAllWinningBids);
});
it('should have function .getHighestUnusedBidResponseForAdUnitCode', function () {
assert.isFunction(getGlobal().getHighestUnusedBidResponseForAdUnitCode);
});
});
});