@@ -8,103 +8,103 @@ import { NativeModules } from 'react-native';
88
99
1010test ( `it calls MixpanelReactNative initialize` , async ( ) => {
11- const mixpanel = await Mixpanel . init ( "token" ) ;
12- expect ( NativeModules . MixpanelReactNative . initialize ) . toBeCalledWith ( "token" , false , { "$lib_version" : "1.5.0" , "mp_lib" : "react-native" } ) ;
11+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
12+ expect ( NativeModules . MixpanelReactNative . initialize ) . toBeCalledWith ( "token" , true , false , { "$lib_version" : "1.5.0" , "mp_lib" : "react-native" } ) ;
1313} ) ;
1414
1515test ( `it calls MixpanelReactNative initialize with optOut and superProperties` , async ( ) => {
16- const mixpanel = new Mixpanel ( "token" ) ;
16+ const mixpanel = new Mixpanel ( "token" , true ) ;
1717 mixpanel . init ( true , { "super" : "property" } )
18- expect ( NativeModules . MixpanelReactNative . initialize ) . toBeCalledWith ( "token" , true , { "$lib_version" : "1.5.0" , "mp_lib" : "react-native" , "super" : "property" } ) ;
18+ expect ( NativeModules . MixpanelReactNative . initialize ) . toBeCalledWith ( "token" , true , true , { "$lib_version" : "1.5.0" , "mp_lib" : "react-native" , "super" : "property" } ) ;
1919} ) ;
2020
2121test ( `it calls MixpanelReactNative setServerURL` , async ( ) => {
22- const mixpanel = await Mixpanel . init ( "token" ) ;
22+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
2323 mixpanel . setServerURL ( "https://api-eu.mixpanel.com" ) ;
2424 expect ( NativeModules . MixpanelReactNative . setServerURL ) . toBeCalledWith ( "token" , "https://api-eu.mixpanel.com" ) ;
2525} ) ;
2626
2727test ( `it calls MixpanelReactNative setLoggingEnabled` , async ( ) => {
28- const mixpanel = await Mixpanel . init ( "token" ) ;
28+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
2929 mixpanel . setLoggingEnabled ( true ) ;
3030 expect ( NativeModules . MixpanelReactNative . setLoggingEnabled ) . toBeCalledWith ( "token" , true ) ;
3131} ) ;
3232
3333test ( `it calls MixpanelReactNative setUseIpAddressForGeolocation` , async ( ) => {
34- const mixpanel = await Mixpanel . init ( "token" ) ;
34+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
3535 mixpanel . setUseIpAddressForGeolocation ( true ) ;
3636 expect ( NativeModules . MixpanelReactNative . setUseIpAddressForGeolocation ) . toBeCalledWith ( "token" , true ) ;
3737} ) ;
3838
3939test ( `it calls MixpanelReactNative hasOptedOutTracking` , async ( ) => {
40- const mixpanel = await Mixpanel . init ( "token" ) ;
40+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
4141 mixpanel . hasOptedOutTracking ( ) ;
4242 expect ( NativeModules . MixpanelReactNative . hasOptedOutTracking ) . toBeCalledWith ( "token" ) ;
4343} ) ;
4444
4545
4646test ( `it calls MixpanelReactNative optInTracking` , async ( ) => {
47- const mixpanel = await Mixpanel . init ( "token" ) ;
47+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
4848 mixpanel . optInTracking ( ) ;
4949 expect ( NativeModules . MixpanelReactNative . optInTracking ) . toBeCalledWith ( "token" ) ;
5050} ) ;
5151
5252test ( `it calls MixpanelReactNative optOutTracking` , async ( ) => {
53- const mixpanel = await Mixpanel . init ( "token" ) ;
53+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
5454 mixpanel . optOutTracking ( ) ;
5555 expect ( NativeModules . MixpanelReactNative . optOutTracking ) . toBeCalledWith ( "token" ) ;
5656} ) ;
5757
5858test ( `it calls MixpanelReactNative identify` , async ( ) => {
59- const mixpanel = await Mixpanel . init ( "token" ) ;
59+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
6060 mixpanel . identify ( "distinct_id" ) ;
6161 expect ( NativeModules . MixpanelReactNative . identify ) . toBeCalledWith ( "token" , "distinct_id" ) ;
6262} ) ;
6363
6464test ( `it calls MixpanelReactNative alias` , async ( ) => {
65- const mixpanel = await Mixpanel . init ( "token" ) ;
65+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
6666 mixpanel . alias ( "alias" , "distinct_id" ) ;
6767 expect ( NativeModules . MixpanelReactNative . alias ) . toBeCalledWith ( "token" , "alias" , "distinct_id" ) ;
6868} ) ;
6969
7070test ( `it calls MixpanelReactNative track` , async ( ) => {
71- const mixpanel = await Mixpanel . init ( "token" ) ;
71+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
7272 mixpanel . track ( "event name" , { "Cool Property" : "Property Value" } ) ;
7373 expect ( NativeModules . MixpanelReactNative . track ) . toBeCalledWith ( "token" , "event name" , { "Cool Property" : "Property Value" } ) ;
7474} ) ;
7575
7676test ( `it calls MixpanelReactNative trackWithGroups` , async ( ) => {
77- const mixpanel = await Mixpanel . init ( "token" ) ;
77+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
7878 mixpanel . trackWithGroups ( "tracked with groups" , { "a" : 1 , "b" : 2.3 } , { "company_id" : "Mixpanel" } ) ;
7979 expect ( NativeModules . MixpanelReactNative . trackWithGroups ) . toBeCalledWith ( "token" , "tracked with groups" , { "a" : 1 , "b" : 2.3 } , { "company_id" : "Mixpanel" } ) ;
8080} ) ;
8181
8282test ( `it calls MixpanelReactNative setGroup` , async ( ) => {
83- const mixpanel = await Mixpanel . init ( "token" ) ;
83+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
8484 mixpanel . setGroup ( "company_id" , 12345 ) ;
8585 expect ( NativeModules . MixpanelReactNative . setGroup ) . toBeCalledWith ( "token" , "company_id" , 12345 ) ;
8686} ) ;
8787
8888test ( `it calls MixpanelReactNative addGroup` , async ( ) => {
89- const mixpanel = await Mixpanel . init ( "token" ) ;
89+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
9090 mixpanel . addGroup ( "company_id" , 12345 ) ;
9191 expect ( NativeModules . MixpanelReactNative . addGroup ) . toBeCalledWith ( "token" , "company_id" , 12345 ) ;
9292} ) ;
9393
9494test ( `it calls MixpanelReactNative removeGroup` , async ( ) => {
95- const mixpanel = await Mixpanel . init ( "token" ) ;
95+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
9696 mixpanel . removeGroup ( "company_id" , 12345 ) ;
9797 expect ( NativeModules . MixpanelReactNative . removeGroup ) . toBeCalledWith ( "token" , "company_id" , 12345 ) ;
9898} ) ;
9999
100100test ( `it calls MixpanelReactNative deleteGroup` , async ( ) => {
101- const mixpanel = await Mixpanel . init ( "token" ) ;
101+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
102102 mixpanel . deleteGroup ( "company_id" , 12345 ) ;
103103 expect ( NativeModules . MixpanelReactNative . deleteGroup ) . toBeCalledWith ( "token" , "company_id" , 12345 ) ;
104104} ) ;
105105
106106test ( `it calls MixpanelReactNative registerSuperProperties` , async ( ) => {
107- const mixpanel = await Mixpanel . init ( "token" ) ;
107+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
108108 mixpanel . registerSuperProperties ( {
109109 "super property" : "super property value" ,
110110 "super property1" : "super property value1" ,
@@ -116,7 +116,7 @@ test(`it calls MixpanelReactNative registerSuperProperties`, async () => {
116116} ) ;
117117
118118test ( `it calls MixpanelReactNative registerSuperPropertiesOnce` , async ( ) => {
119- const mixpanel = await Mixpanel . init ( "token" ) ;
119+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
120120 mixpanel . registerSuperPropertiesOnce ( {
121121 "super property" : "super property value" ,
122122 "super property1" : "super property value1" ,
@@ -128,49 +128,49 @@ test(`it calls MixpanelReactNative registerSuperPropertiesOnce`, async () => {
128128} ) ;
129129
130130test ( `it calls MixpanelReactNative unregisterSuperProperty` , async ( ) => {
131- const mixpanel = await Mixpanel . init ( "token" ) ;
131+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
132132 mixpanel . unregisterSuperProperty ( "super property" ) ;
133133 expect ( NativeModules . MixpanelReactNative . unregisterSuperProperty ) . toBeCalledWith ( "token" , "super property" ) ;
134134} ) ;
135135
136136test ( `it calls MixpanelReactNative getSuperProperties` , async ( ) => {
137- const mixpanel = await Mixpanel . init ( "token" ) ;
137+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
138138 mixpanel . getSuperProperties ( ) ;
139139 expect ( NativeModules . MixpanelReactNative . getSuperProperties ) . toBeCalledWith ( "token" ) ;
140140} ) ;
141141
142142test ( `it calls MixpanelReactNative clearSuperProperties` , async ( ) => {
143- const mixpanel = await Mixpanel . init ( "token" ) ;
143+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
144144 mixpanel . clearSuperProperties ( ) ;
145145 expect ( NativeModules . MixpanelReactNative . clearSuperProperties ) . toBeCalledWith ( "token" ) ;
146146} ) ;
147147
148148test ( `it calls MixpanelReactNative timeEvent` , async ( ) => {
149- const mixpanel = await Mixpanel . init ( "token" ) ;
149+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
150150 mixpanel . timeEvent ( "Timed Event" ) ;
151151 expect ( NativeModules . MixpanelReactNative . timeEvent ) . toBeCalledWith ( "token" , "Timed Event" ) ;
152152} ) ;
153153
154154test ( `it calls MixpanelReactNative eventElapsedTime` , async ( ) => {
155- const mixpanel = await Mixpanel . init ( "token" ) ;
155+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
156156 mixpanel . eventElapsedTime ( "Timed Event" ) ;
157157 expect ( NativeModules . MixpanelReactNative . eventElapsedTime ) . toBeCalledWith ( "token" , "Timed Event" ) ;
158158} ) ;
159159
160160test ( `it calls MixpanelReactNative reset` , async ( ) => {
161- const mixpanel = await Mixpanel . init ( "token" ) ;
161+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
162162 mixpanel . reset ( ) ;
163163 expect ( NativeModules . MixpanelReactNative . reset ) . toBeCalledWith ( "token" ) ;
164164} ) ;
165165
166166test ( `it calls MixpanelReactNative getDistinctId` , async ( ) => {
167- const mixpanel = await Mixpanel . init ( "token" ) ;
167+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
168168 mixpanel . getDistinctId ( ) ;
169169 expect ( NativeModules . MixpanelReactNative . getDistinctId ) . toBeCalledWith ( "token" ) ;
170170} ) ;
171171
172172test ( `it calls MixpanelReactNative profile set` , async ( ) => {
173- const mixpanel = await Mixpanel . init ( "token" ) ;
173+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
174174 mixpanel . getPeople ( ) . set ( {
175175 "a" : 1 ,
176176 "b" : 2.3 ,
@@ -187,7 +187,7 @@ test(`it calls MixpanelReactNative profile set`, async () => {
187187} ) ;
188188
189189test ( `it calls MixpanelReactNative profile setOnce` , async ( ) => {
190- const mixpanel = await Mixpanel . init ( "token" ) ;
190+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
191191 mixpanel . getPeople ( ) . setOnce ( {
192192 "a" : 1 ,
193193 "b" : 2.3 ,
@@ -204,7 +204,7 @@ test(`it calls MixpanelReactNative profile setOnce`, async () => {
204204} ) ;
205205
206206test ( `it calls MixpanelReactNative profile increment` , async ( ) => {
207- const mixpanel = await Mixpanel . init ( "token" ) ;
207+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
208208 mixpanel . getPeople ( ) . increment ( {
209209 "a" : 1 ,
210210 "b" : 2.3 ,
@@ -219,73 +219,73 @@ test(`it calls MixpanelReactNative profile increment`, async () => {
219219} ) ;
220220
221221test ( `it calls MixpanelReactNative profile append` , async ( ) => {
222- const mixpanel = await Mixpanel . init ( "token" ) ;
222+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
223223 mixpanel . getPeople ( ) . append ( "a" , "1" ) ;
224224 expect ( NativeModules . MixpanelReactNative . append ) . toBeCalledWith ( "token" , { "a" : "1" } ) ;
225225} ) ;
226226
227227test ( `it calls MixpanelReactNative profile union` , async ( ) => {
228- const mixpanel = await Mixpanel . init ( "token" ) ;
228+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
229229 mixpanel . getPeople ( ) . union ( "a1" , "1" ) ;
230230 expect ( NativeModules . MixpanelReactNative . union ) . toBeCalledWith ( "token" , { "a1" : [ "1" ] } ) ;
231231} ) ;
232232
233233test ( `it calls MixpanelReactNative profile remove` , async ( ) => {
234- const mixpanel = await Mixpanel . init ( "token" ) ;
234+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
235235 mixpanel . getPeople ( ) . remove ( "a" , "1" ) ;
236236 expect ( NativeModules . MixpanelReactNative . remove ) . toBeCalledWith ( "token" , { "a" : "1" } ) ;
237237} ) ;
238238
239239test ( `it calls MixpanelReactNative profile unset` , async ( ) => {
240- const mixpanel = await Mixpanel . init ( "token" ) ;
240+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
241241 mixpanel . getPeople ( ) . unset ( "a" ) ;
242242 expect ( NativeModules . MixpanelReactNative . unset ) . toBeCalledWith ( "token" , "a" ) ;
243243} ) ;
244244
245245test ( `it calls MixpanelReactNative profile trackCharge` , async ( ) => {
246- const mixpanel = await Mixpanel . init ( "token" ) ;
246+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
247247 mixpanel . getPeople ( ) . trackCharge ( 22.8 ) ;
248248 expect ( NativeModules . MixpanelReactNative . trackCharge ) . toBeCalledWith ( "token" , 22.8 , { } ) ;
249249} ) ;
250250
251251test ( `it calls MixpanelReactNative profile clearCharges` , async ( ) => {
252- const mixpanel = await Mixpanel . init ( "token" ) ;
252+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
253253 mixpanel . getPeople ( ) . clearCharges ( ) ;
254254 expect ( NativeModules . MixpanelReactNative . clearCharges ) . toBeCalledWith ( "token" ) ;
255255} ) ;
256256
257257test ( `it calls MixpanelReactNative profile deleteUser` , async ( ) => {
258- const mixpanel = await Mixpanel . init ( "token" ) ;
258+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
259259 mixpanel . getPeople ( ) . deleteUser ( ) ;
260260 expect ( NativeModules . MixpanelReactNative . deleteUser ) . toBeCalledWith ( "token" ) ;
261261} ) ;
262262
263263test ( `it calls MixpanelReactNative group set properties` , async ( ) => {
264- const mixpanel = await Mixpanel . init ( "token" ) ;
264+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
265265 mixpanel . getGroup ( "company_id" , 12345 ) . set ( "prop_key" , "prop_value" ) ;
266266 expect ( NativeModules . MixpanelReactNative . groupSetProperties ) . toBeCalledWith ( "token" , "company_id" , 12345 , { "prop_key" : "prop_value" } ) ;
267267} ) ;
268268
269269test ( `it calls MixpanelReactNative group set property once` , async ( ) => {
270- const mixpanel = await Mixpanel . init ( "token" ) ;
270+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
271271 mixpanel . getGroup ( "company_id" , 12345 ) . setOnce ( "prop_key" , "prop_value" ) ;
272272 expect ( NativeModules . MixpanelReactNative . groupSetPropertyOnce ) . toBeCalledWith ( "token" , "company_id" , 12345 , { "prop_key" : "prop_value" } ) ;
273273} ) ;
274274
275275test ( `it calls MixpanelReactNative group unset property` , async ( ) => {
276- const mixpanel = await Mixpanel . init ( "token" ) ;
276+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
277277 mixpanel . getGroup ( "company_id" , 12345 ) . unset ( "prop_key" ) ;
278278 expect ( NativeModules . MixpanelReactNative . groupUnsetProperty ) . toBeCalledWith ( "token" , "company_id" , 12345 , "prop_key" ) ;
279279} ) ;
280280
281281test ( `it calls MixpanelReactNative group remove property` , async ( ) => {
282- const mixpanel = await Mixpanel . init ( "token" ) ;
282+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
283283 mixpanel . getGroup ( "company_id" , 12345 ) . remove ( "prop_key" , "334" ) ;
284284 expect ( NativeModules . MixpanelReactNative . groupRemovePropertyValue ) . toBeCalledWith ( "token" , "company_id" , 12345 , "prop_key" , "334" ) ;
285285} ) ;
286286
287287test ( `it calls MixpanelReactNative group union property` , async ( ) => {
288- const mixpanel = await Mixpanel . init ( "token" ) ;
288+ const mixpanel = await Mixpanel . init ( "token" , true ) ;
289289 mixpanel . getGroup ( "company_id" , 12345 ) . union ( "prop_key" , "334" ) ;
290290 expect ( NativeModules . MixpanelReactNative . groupRemovePropertyValue ) . toBeCalledWith ( "token" , "company_id" , 12345 , "prop_key" , "334" ) ;
291291} ) ;
0 commit comments