|
41 | 41 | amplitude = mock([Amplitude class]); |
42 | 42 | amprevenue = mock([AMPRevenue class]); |
43 | 43 | identify = mock([AMPIdentify class]); |
44 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{} andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 44 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{} andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
45 | 45 | }); |
46 | 46 |
|
47 | 47 | describe(@"Identify", ^{ |
|
51 | 51 | @"traitsToSetOnce" : [NSNull null] } |
52 | 52 | andAmplitude:amplitude |
53 | 53 | andAmpRevenue:amprevenue |
54 | | - andAmpIdentify:identify]; |
| 54 | + andAmpIdentify:identify |
| 55 | + setupBlock:nil]; |
55 | 56 | SEGIdentifyPayload *payload = [[SEGIdentifyPayload alloc] initWithUserId:@"1111" anonymousId:nil traits:@{} context:@{} integrations:@{}]; |
56 | 57 |
|
57 | 58 | [integration identify:payload]; |
|
63 | 64 | @"traitsToSetOnce" : @[] } |
64 | 65 | andAmplitude:amplitude |
65 | 66 | andAmpRevenue:amprevenue |
66 | | - andAmpIdentify:identify]; |
| 67 | + andAmpIdentify:identify |
| 68 | + setupBlock:nil]; |
67 | 69 | SEGIdentifyPayload *payload = [[SEGIdentifyPayload alloc] initWithUserId:@"7891" anonymousId:nil traits:@{ |
68 | 70 | @"name" : @"George Costanza", |
69 | 71 | @"gender" : @"male", |
|
91 | 93 | }); |
92 | 94 |
|
93 | 95 | it(@"increments identify trait", ^{ |
94 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"traitsToIncrement" : @[ @"karma", @"store_credit" ] } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 96 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"traitsToIncrement" : @[ @"karma", @"store_credit" ] } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
95 | 97 |
|
96 | 98 | SEGIdentifyPayload *payload = [[SEGIdentifyPayload alloc] initWithUserId:@"3290842" anonymousId:nil traits:@{ @"karma" : @0.23, |
97 | 99 | @"store_credit" : @20, |
|
106 | 108 | }); |
107 | 109 |
|
108 | 110 | it(@"sets identify trait once", ^{ |
109 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"traitsToSetOnce" : @[ @"sign_up_date" ] } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 111 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"traitsToSetOnce" : @[ @"sign_up_date" ] } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
110 | 112 |
|
111 | 113 | SEGIdentifyPayload *payload = [[SEGIdentifyPayload alloc] initWithUserId:@"3290842" anonymousId:nil traits:@{ @"sign_up_date" : @"2015-08-24", |
112 | 114 | @"city" : @"los angeles" } |
|
123 | 125 | @"traitsToIncrement" : @[ @"age" ] } |
124 | 126 | andAmplitude:amplitude |
125 | 127 | andAmpRevenue:amprevenue |
126 | | - andAmpIdentify:identify]; |
| 128 | + andAmpIdentify:identify |
| 129 | + setupBlock:nil]; |
127 | 130 |
|
128 | 131 | SEGIdentifyPayload *payload = [[SEGIdentifyPayload alloc] initWithUserId:@"3290842" anonymousId:nil traits:@{ @"address" : @{ |
129 | 132 | @"street" : @"California st", |
|
149 | 152 |
|
150 | 153 | describe(@"Screen", ^{ |
151 | 154 | it(@"does not call screen if trackAllPages = false", ^{ |
152 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"trackAllPages" : @false } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 155 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"trackAllPages" : @false } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
153 | 156 |
|
154 | 157 | SEGScreenPayload *payload = [[SEGScreenPayload alloc] initWithName:@"Shirts" properties:@{} context:@{} integrations:@{}]; |
155 | 158 | [integration screen:payload]; |
156 | 159 | [verifyCount(amplitude, never()) logEvent:@"Viewed Shirts Screen" withEventProperties:@{}]; |
157 | 160 | }); |
158 | 161 |
|
159 | 162 | it(@"trackAllPages", ^{ |
160 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"trackAllPages" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 163 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"trackAllPages" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
161 | 164 |
|
162 | 165 | SEGScreenPayload *payload = [[SEGScreenPayload alloc] initWithName:@"Shirts" properties:@{} context:@{} integrations:@{}]; |
163 | 166 | [integration screen:payload]; |
164 | 167 | [verify(amplitude) logEvent:@"Viewed Shirts Screen" withEventProperties:@{} withGroups:nil outOfSession:false]; |
165 | 168 | }); |
166 | 169 |
|
167 | 170 | it(@"trackAllPagesV2", ^{ |
168 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"trackAllPagesV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 171 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"trackAllPagesV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
169 | 172 |
|
170 | 173 | SEGScreenPayload *payload = [[SEGScreenPayload alloc] initWithName:@"Shirts" properties:@{ @"url" : @"seinfeld.wikia.com/wiki/The_Puffy_Shirt", |
171 | 174 | @"Feed Type" : @"private" } |
|
191 | 194 | @"groupTypeTrait" : @"industry" } |
192 | 195 | andAmplitude:amplitude |
193 | 196 | andAmpRevenue:amprevenue |
194 | | - andAmpIdentify:identify]; |
| 197 | + andAmpIdentify:identify |
| 198 | + setupBlock:nil]; |
195 | 199 | SEGGroupPayload *payload = [[SEGGroupPayload alloc] initWithGroupId:@"32423084" traits:@{ |
196 | 200 | @"company" : @"Segment", |
197 | 201 | @"industry" : @"Technology" |
|
289 | 293 |
|
290 | 294 |
|
291 | 295 | it(@"tracks Order Completed with revenue if both total and revenue are present", ^{ |
292 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 296 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
293 | 297 |
|
294 | 298 | NSDictionary *props = @{ |
295 | 299 | @"checkout_id" : @"9bcf000000000000", |
|
321 | 325 | }); |
322 | 326 |
|
323 | 327 | it(@"tracks Order Completed with total if revenue is not present", ^{ |
324 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 328 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
325 | 329 |
|
326 | 330 | NSDictionary *props = @{ |
327 | 331 | @"checkout_id" : @"9bcf000000000000", |
|
353 | 357 | }); |
354 | 358 |
|
355 | 359 | it(@"tracks Order Completed with revenue of type String", ^{ |
356 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 360 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
357 | 361 |
|
358 | 362 | NSDictionary *props = @{ |
359 | 363 | @"checkout_id" : @"9bcf000000000000", |
|
386 | 390 |
|
387 | 391 | // NOTE: This is against our spec. We do not have a v1/v2 ECommerce event that sends both revenue and price/quantity as a tope level property |
388 | 392 | it(@"tracks with top level price and quantity", ^{ |
389 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 393 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
390 | 394 |
|
391 | 395 | SEGTrackPayload *payload = [[SEGTrackPayload alloc] initWithEvent:@"Viewed Product" properties:@{ |
392 | 396 | @"revenue" : @20.99, |
|
406 | 410 | }); |
407 | 411 |
|
408 | 412 | it(@"tracks Amplitude ecommerce fields", ^{ |
409 | | - integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify]; |
| 413 | + integration = [[SEGAmplitudeIntegration alloc] initWithSettings:@{ @"useLogRevenueV2" : @true } andAmplitude:amplitude andAmpRevenue:amprevenue andAmpIdentify:identify setupBlock:nil]; |
410 | 414 |
|
411 | 415 | SEGTrackPayload *payload = [[SEGTrackPayload alloc] initWithEvent:@"Viewed Product" properties:@{ |
412 | 416 | @"revenue" : @20.00, |
|
0 commit comments