@@ -364,14 +364,21 @@ class MixpanelDemoTests: MixpanelBaseTests {
364
364
let testMixpanel = Mixpanel . initialize ( token: randomId ( ) , trackAutomaticEvents: true , flushInterval: 60 )
365
365
let testMixpanel2 = Mixpanel . initialize ( token: randomId ( ) , trackAutomaticEvents: true , flushInterval: 60 )
366
366
XCTAssertNotEqual ( testMixpanel. distinctId, testMixpanel2. distinctId, " by default, distinctId should not be unique to the device " )
367
-
367
+
368
368
let testMixpanel3 = Mixpanel . initialize ( token: randomId ( ) , trackAutomaticEvents: true , flushInterval: 60 , useUniqueDistinctId: false )
369
369
let testMixpanel4 = Mixpanel . initialize ( token: randomId ( ) , trackAutomaticEvents: true , flushInterval: 60 , useUniqueDistinctId: false )
370
370
XCTAssertNotEqual ( testMixpanel3. distinctId, testMixpanel4. distinctId, " distinctId should not be unique to the device if useUniqueDistinctId is set to false " )
371
-
371
+
372
372
let testMixpanel5 = Mixpanel . initialize ( token: randomId ( ) , trackAutomaticEvents: true , flushInterval: 60 , useUniqueDistinctId: true )
373
373
let testMixpanel6 = Mixpanel . initialize ( token: randomId ( ) , trackAutomaticEvents: true , flushInterval: 60 , useUniqueDistinctId: true )
374
374
XCTAssertEqual ( testMixpanel5. distinctId, testMixpanel6. distinctId, " distinctId should be unique to the device if useUniqueDistinctId is set to true " )
375
+
376
+ removeDBfile ( testMixpanel. apiToken)
377
+ removeDBfile ( testMixpanel2. apiToken)
378
+ removeDBfile ( testMixpanel3. apiToken)
379
+ removeDBfile ( testMixpanel4. apiToken)
380
+ removeDBfile ( testMixpanel5. apiToken)
381
+ removeDBfile ( testMixpanel6. apiToken)
375
382
}
376
383
377
384
func testHadPersistedDistinctId( ) {
@@ -554,6 +561,7 @@ class MixpanelDemoTests: MixpanelBaseTests {
554
561
let e = eventQueue ( token: testMixpanel. apiToken) . last!
555
562
let p = e [ " properties " ] as! InternalProperties
556
563
XCTAssertNotNil ( p [ " mp_lib " ] , " flutter " )
564
+ removeDBfile ( testMixpanel. apiToken)
557
565
}
558
566
559
567
func testInvalidPropertiesTrack( ) {
@@ -933,6 +941,7 @@ class MixpanelDemoTests: MixpanelBaseTests {
933
941
testMixpanel = Mixpanel . initialize ( token: testToken, trackAutomaticEvents: true , flushInterval: 60 )
934
942
testMixpanel2 = Mixpanel . initialize ( token: testToken, trackAutomaticEvents: true , flushInterval: 60 )
935
943
XCTAssertTrue ( testMixpanel === testMixpanel2, " instance with same token should be reused and no sqlite db locked error should be populated " )
944
+ removeDBfile ( testToken)
936
945
}
937
946
938
947
func testMultipleInstancesWithSameTokenButDifferentInstanceNameShouldNotCrash( ) {
@@ -957,6 +966,7 @@ class MixpanelDemoTests: MixpanelBaseTests {
957
966
958
967
func testMultipleInstancesWithSameTokenButDifferentInstanceName( ) {
959
968
let testToken = randomId ( )
969
+ removeDBfile ( testToken)
960
970
let instance1 = Mixpanel . initialize ( token: testToken, trackAutomaticEvents: true , flushInterval: 60 , instanceName: " instance1 " )
961
971
let instance2 = Mixpanel . initialize ( token: testToken, trackAutomaticEvents: true , flushInterval: 60 , instanceName: " instance2 " )
962
972
@@ -974,7 +984,6 @@ class MixpanelDemoTests: MixpanelBaseTests {
974
984
975
985
instance1. people. set ( property: " p1 " , to: " a " )
976
986
waitForTrackingQueue ( instance1)
977
-
978
987
let peopleQueue_value = peopleQueue ( token: " instance1 " )
979
988
let setValue = peopleQueue_value. last![ " $set " ] as! InternalProperties
980
989
XCTAssertEqual ( setValue [ " p1 " ] as? String , " a " , " custom people property not queued " )
0 commit comments