@@ -88,7 +88,7 @@ public void trackAllDisabledInOptionsButIntegrationEnabledWithOptions() {
88
88
}
89
89
90
90
@ Test
91
- public void trackNoEventPlan () throws IOException {
91
+ public void trackPlanForEvent () throws IOException {
92
92
TrackPayload payload = new TrackPayload .Builder ()
93
93
.event ("Install Attributed" )
94
94
.userId ("userId" )
@@ -107,6 +107,27 @@ public void trackNoEventPlan() throws IOException {
107
107
verify (integration ).track (payload );
108
108
}
109
109
110
+ @ Test
111
+ public void trackPlanForEventWithOptions () throws IOException {
112
+ TrackPayload payload = new TrackPayload .Builder ()
113
+ .event ("Install Attributed" )
114
+ .userId ("userId" )
115
+ .integrations (Collections .singletonMap ("All" , false ))
116
+ .build ();
117
+ track (
118
+ payload ,
119
+ "Mixpanel" ,
120
+ Cartographer .INSTANCE .fromJson (
121
+ "{\n "
122
+ + " \" plan\" : {\n "
123
+ + " \" track\" : {\n "
124
+ + " \" Completed Order\" : {}\n "
125
+ + " }\n "
126
+ + " }\n "
127
+ + "}" ));
128
+ verify (integration , never ()).track (payload );
129
+ }
130
+
110
131
@ Test
111
132
public void trackPlanDisabledEvent () throws IOException {
112
133
TrackPayload payload = new TrackPayload .Builder ()
@@ -222,4 +243,95 @@ public void ignoresSegment() throws IOException {
222
243
+ "}" ));
223
244
verify (integration ).track (payload );
224
245
}
246
+
247
+ @ Test
248
+ public void defaultNewEventsEnabled () throws IOException {
249
+ TrackPayload payload = new TrackPayload .Builder ()
250
+ .event ("Install Attributed" )
251
+ .userId ("userId" )
252
+ .build ();
253
+ track (
254
+ payload ,
255
+ "Segment.io" ,
256
+ Cartographer .INSTANCE .fromJson (
257
+ "{\n " +
258
+ " \" plan\" : {\n " +
259
+ " \" track\" : {\n " +
260
+ " \" __default\" : {\n " +
261
+ " \" enabled\" : true\n " +
262
+ " }\n " +
263
+ " }\n " +
264
+ " }\n " +
265
+ "}" ));
266
+ verify (integration ).track (payload );
267
+ }
268
+
269
+ @ Test
270
+ public void defaultNewEventsDisabled () throws IOException {
271
+ TrackPayload payload = new TrackPayload .Builder ()
272
+ .event ("Install Attributed" )
273
+ .userId ("userId" )
274
+ .build ();
275
+ track (
276
+ payload ,
277
+ "Mixpanel" ,
278
+ Cartographer .INSTANCE .fromJson (
279
+ "{\n " +
280
+ " \" plan\" : {\n " +
281
+ " \" track\" : {\n " +
282
+ " \" __default\" : {\n " +
283
+ " \" enabled\" : false\n " +
284
+ " }\n " +
285
+ " }\n " +
286
+ " }\n " +
287
+ "}" ));
288
+ verify (integration , never ()).track (payload );
289
+ }
290
+
291
+ @ Test
292
+ public void defaultNewEventsDisabledSendToSegment () throws IOException {
293
+ TrackPayload payload = new TrackPayload .Builder ()
294
+ .event ("Install Attributed" )
295
+ .userId ("userId" )
296
+ .build ();
297
+ track (
298
+ payload ,
299
+ "Segment.io" ,
300
+ Cartographer .INSTANCE .fromJson (
301
+ "{\n " +
302
+ " \" plan\" : {\n " +
303
+ " \" track\" : {\n " +
304
+ " \" __default\" : {\n " +
305
+ " \" enabled\" : false\n " +
306
+ " }\n " +
307
+ " }\n " +
308
+ " }\n " +
309
+ "}" ));
310
+ verify (integration ).track (payload );
311
+ }
312
+
313
+ @ Test
314
+ public void eventPlanOverridesSchemaDefault () throws IOException {
315
+ TrackPayload payload = new TrackPayload .Builder ()
316
+ .event ("Install Attributed" )
317
+ .userId ("userId" )
318
+ .build ();
319
+ track (
320
+ payload ,
321
+ "Mixpanel" ,
322
+ Cartographer .INSTANCE .fromJson (
323
+ "{\n " +
324
+ " \" plan\" : {\n " +
325
+ " \" track\" : {\n " +
326
+ " \" __default\" : {\n " +
327
+ " \" enabled\" : true\n " +
328
+ " },\n " +
329
+ " \" Install Attributed\" : {\n " +
330
+ " \" enabled\" : false\n " +
331
+ " }\n " +
332
+ " }\n " +
333
+ " }\n " +
334
+ "}" ));
335
+ verify (integration , never ()).track (payload );
336
+ }
225
337
}
0 commit comments