@@ -5,30 +5,30 @@ var tester = require('analytics.js-integration-tester');
5
5
var sandbox = require ( 'clear-env' ) ;
6
6
var AdRoll = require ( './' ) ;
7
7
8
- describe ( 'AdRoll' , function ( ) {
8
+ describe ( 'AdRoll' , function ( ) {
9
9
var adroll ;
10
10
var analytics ;
11
11
var options = {
12
12
advId : 'FSQJWMMZ2NEAZH6XWKVCNO' ,
13
13
pixId : 'N6HGWT4ALRDRXCAO5PLTB6'
14
14
} ;
15
15
16
- beforeEach ( function ( ) {
16
+ beforeEach ( function ( ) {
17
17
analytics = new Analytics ( ) ;
18
18
adroll = new AdRoll ( options ) ;
19
19
analytics . use ( AdRoll ) ;
20
20
analytics . use ( tester ) ;
21
21
analytics . add ( adroll ) ;
22
22
} ) ;
23
23
24
- afterEach ( function ( ) {
24
+ afterEach ( function ( ) {
25
25
analytics . restore ( ) ;
26
26
analytics . reset ( ) ;
27
27
adroll . reset ( ) ;
28
28
sandbox ( ) ;
29
29
} ) ;
30
30
31
- it ( 'should have the right settings' , function ( ) {
31
+ it ( 'should have the right settings' , function ( ) {
32
32
analytics . compare ( AdRoll , integration ( 'AdRoll' )
33
33
. assumesPageview ( )
34
34
. global ( '__adroll' )
@@ -41,41 +41,41 @@ describe('AdRoll', function(){
41
41
. mapping ( 'events' ) ) ;
42
42
} ) ;
43
43
44
- describe ( 'before loading' , function ( ) {
45
- beforeEach ( function ( ) {
44
+ describe ( 'before loading' , function ( ) {
45
+ beforeEach ( function ( ) {
46
46
analytics . stub ( adroll , 'load' ) ;
47
47
} ) ;
48
48
49
- afterEach ( function ( ) {
49
+ afterEach ( function ( ) {
50
50
adroll . reset ( ) ;
51
51
} ) ;
52
52
53
- describe ( '#initialize' , function ( ) {
54
- it ( 'should initialize the adroll variables' , function ( ) {
53
+ describe ( '#initialize' , function ( ) {
54
+ it ( 'should initialize the adroll variables' , function ( ) {
55
55
analytics . initialize ( ) ;
56
56
analytics . page ( ) ;
57
57
analytics . equal ( window . adroll_adv_id , options . advId ) ;
58
58
analytics . equal ( window . adroll_pix_id , options . pixId ) ;
59
59
} ) ;
60
60
61
- it ( 'should set window.__adroll_loaded' , function ( ) {
61
+ it ( 'should set window.__adroll_loaded' , function ( ) {
62
62
analytics . initialize ( ) ;
63
63
analytics . page ( ) ;
64
64
analytics . assert ( window . __adroll_loaded ) ;
65
65
} ) ;
66
66
67
- it ( 'should call #load' , function ( ) {
67
+ it ( 'should call #load' , function ( ) {
68
68
analytics . initialize ( ) ;
69
69
analytics . page ( ) ;
70
70
analytics . called ( adroll . load ) ;
71
71
} ) ;
72
72
73
- describe ( 'with user' , function ( ) {
74
- beforeEach ( function ( ) {
73
+ describe ( 'with user' , function ( ) {
74
+ beforeEach ( function ( ) {
75
75
analytics . user ( ) . identify ( 'id' ) ;
76
76
} ) ;
77
77
78
- it ( 'should not set a user id' , function ( ) {
78
+ it ( 'should not set a user id' , function ( ) {
79
79
analytics . initialize ( ) ;
80
80
analytics . page ( ) ;
81
81
analytics . assert ( ! window . adroll_custom_data ) ;
@@ -84,25 +84,25 @@ describe('AdRoll', function(){
84
84
} ) ;
85
85
} ) ;
86
86
87
- describe ( 'loading' , function ( ) {
88
- it ( 'should load' , function ( done ) {
87
+ describe ( 'loading' , function ( ) {
88
+ it ( 'should load' , function ( done ) {
89
89
analytics . load ( adroll , done ) ;
90
90
} ) ;
91
91
} ) ;
92
92
93
- describe ( 'after loading' , function ( ) {
94
- beforeEach ( function ( done ) {
93
+ describe ( 'after loading' , function ( ) {
94
+ beforeEach ( function ( done ) {
95
95
analytics . once ( 'ready' , done ) ;
96
96
analytics . initialize ( ) ;
97
97
analytics . page ( ) ;
98
98
} ) ;
99
99
100
- describe ( '#page' , function ( ) {
101
- beforeEach ( function ( ) {
100
+ describe ( '#page' , function ( ) {
101
+ beforeEach ( function ( ) {
102
102
analytics . stub ( window . __adroll , 'record_user' ) ;
103
103
} ) ;
104
104
105
- it ( 'should track page view with fullName' , function ( ) {
105
+ it ( 'should track page view with fullName' , function ( ) {
106
106
analytics . page ( 'Category' , 'Name' , { url : 'http://localhost:34448/test/' } ) ;
107
107
analytics . called ( window . __adroll . record_user , {
108
108
adroll_segments : 'viewed_category_name_page' ,
@@ -118,7 +118,7 @@ describe('AdRoll', function(){
118
118
} ) ;
119
119
} ) ;
120
120
121
- it ( 'should track unnamed/categorized page' , function ( ) {
121
+ it ( 'should track unnamed/categorized page' , function ( ) {
122
122
analytics . page ( { url : 'http://localhost:34448/test/' } ) ;
123
123
analytics . called ( window . __adroll . record_user , {
124
124
adroll_segments : 'loaded_a_page' ,
@@ -132,7 +132,7 @@ describe('AdRoll', function(){
132
132
} ) ;
133
133
} ) ;
134
134
135
- it ( 'should track unnamed page' , function ( ) {
135
+ it ( 'should track unnamed page' , function ( ) {
136
136
analytics . page ( 'Name' , { url : 'http://localhost:34448/test/' } ) ;
137
137
analytics . called ( window . __adroll . record_user , {
138
138
adroll_segments : 'viewed_name_page' ,
@@ -147,7 +147,7 @@ describe('AdRoll', function(){
147
147
} ) ;
148
148
} ) ;
149
149
150
- it ( 'should track uncategorized page' , function ( ) {
150
+ it ( 'should track uncategorized page' , function ( ) {
151
151
analytics . page ( 'Name' , { url : 'http://localhost:34448/test/' } ) ;
152
152
analytics . called ( window . __adroll . record_user , {
153
153
adroll_segments : 'viewed_name_page' ,
@@ -163,27 +163,27 @@ describe('AdRoll', function(){
163
163
} ) ;
164
164
} ) ;
165
165
166
- describe ( '#track' , function ( ) {
167
- beforeEach ( function ( ) {
166
+ describe ( '#track' , function ( ) {
167
+ beforeEach ( function ( ) {
168
168
analytics . stub ( window . __adroll , 'record_user' ) ;
169
169
} ) ;
170
170
171
- it ( 'should snake case event name' , function ( ) {
171
+ it ( 'should snake case event name' , function ( ) {
172
172
analytics . track ( 'Event A' ) ;
173
173
analytics . called ( window . __adroll . record_user , {
174
174
adroll_segments : 'event_a'
175
175
} ) ;
176
176
} ) ;
177
177
178
- describe ( 'event not in events' , function ( ) {
179
- it ( 'should send events with only adroll_segments' , function ( ) {
178
+ describe ( 'event not in events' , function ( ) {
179
+ it ( 'should send events with only adroll_segments' , function ( ) {
180
180
analytics . track ( 'event' , { } ) ;
181
181
analytics . called ( window . __adroll . record_user , {
182
182
adroll_segments : 'event'
183
183
} ) ;
184
184
} ) ;
185
185
186
- it ( 'should send events with revenue and order id' , function ( ) {
186
+ it ( 'should send events with revenue and order id' , function ( ) {
187
187
analytics . track ( 'event' , { revenue : 3.99 , order_id : 1 } ) ;
188
188
analytics . called ( window . __adroll . record_user , {
189
189
adroll_segments : 'event' ,
@@ -192,7 +192,7 @@ describe('AdRoll', function(){
192
192
} ) ;
193
193
} ) ;
194
194
195
- it ( 'should pass user id in' , function ( ) {
195
+ it ( 'should pass user id in' , function ( ) {
196
196
analytics . user ( ) . identify ( 'id' ) ;
197
197
analytics . track ( 'event' , { revenue : 3.99 } ) ;
198
198
analytics . called ( window . __adroll . record_user , {
@@ -203,12 +203,12 @@ describe('AdRoll', function(){
203
203
} ) ;
204
204
} ) ;
205
205
206
- describe ( 'event in events' , function ( ) {
207
- beforeEach ( function ( ) {
206
+ describe ( 'event in events' , function ( ) {
207
+ beforeEach ( function ( ) {
208
208
adroll . options . events = { event : 'segment' } ;
209
209
} ) ;
210
210
211
- it ( 'should pass in revenue and order id' , function ( ) {
211
+ it ( 'should pass in revenue and order id' , function ( ) {
212
212
analytics . track ( 'event' , { total : 1.99 , orderId : 1 } ) ;
213
213
analytics . called ( window . __adroll . record_user , {
214
214
adroll_segments : 'segment' ,
@@ -217,15 +217,15 @@ describe('AdRoll', function(){
217
217
} ) ;
218
218
} ) ;
219
219
220
- it ( 'should pass .revenue as conversion value' , function ( ) {
220
+ it ( 'should pass .revenue as conversion value' , function ( ) {
221
221
analytics . track ( 'event' , { revenue : 2.99 } ) ;
222
222
analytics . called ( window . __adroll . record_user , {
223
223
adroll_segments : 'segment' ,
224
224
adroll_conversion_value_in_dollars : 2.99
225
225
} ) ;
226
226
} ) ;
227
227
228
- it ( 'should include the user_id when available' , function ( ) {
228
+ it ( 'should include the user_id when available' , function ( ) {
229
229
analytics . user ( ) . identify ( 'id' ) ;
230
230
analytics . track ( 'event' , { revenue : 3.99 } ) ;
231
231
analytics . called ( window . __adroll . record_user , {
@@ -235,7 +235,7 @@ describe('AdRoll', function(){
235
235
} ) ;
236
236
} ) ;
237
237
238
- it ( 'should pass custom data like product id and sku' , function ( ) {
238
+ it ( 'should pass custom data like product id and sku' , function ( ) {
239
239
analytics . track ( 'event' , { revenue : 2.99 , id : '12345' , sku : '43434-21' , other : '1234' } ) ;
240
240
analytics . called ( window . __adroll . record_user , {
241
241
adroll_segments : 'segment' ,
@@ -247,7 +247,7 @@ describe('AdRoll', function(){
247
247
} ) ;
248
248
} ) ;
249
249
250
- it ( 'should support array events' , function ( ) {
250
+ it ( 'should support array events' , function ( ) {
251
251
adroll . options . events = [ { key : 'event' , value : 'pixel' } ] ;
252
252
analytics . track ( 'event' , { total : 2.99 , orderId : 2 } ) ;
253
253
analytics . called ( window . __adroll . record_user , {
@@ -257,7 +257,7 @@ describe('AdRoll', function(){
257
257
} ) ;
258
258
} ) ;
259
259
260
- it ( 'should track multiple events' , function ( ) {
260
+ it ( 'should track multiple events' , function ( ) {
261
261
adroll . options . events = [ { key : 'event' , value : 'one' } ] ;
262
262
adroll . options . events . push ( { key : 'event' , value : 'two' } ) ;
263
263
analytics . track ( 'event' , { total : 2.99 , orderId : 2 } ) ;
0 commit comments