@@ -202,19 +202,20 @@ class UserMergeScenariosTests: XCTestCase, AuthProvider {
202
202
}
203
203
waitForDuration ( seconds: 5 )
204
204
205
+ let expectation1 = self . expectation ( description: " Events properly cleared " )
205
206
if let events = localStorage. anonymousUserEvents {
206
207
XCTAssertFalse ( events. isEmpty, " Expected events to be logged " )
207
208
} else {
208
- XCTFail ( " Events were incorrectly cleared " )
209
+ expectation1 . fulfill ( )
209
210
}
210
211
211
212
// Verify "merge user" API call is not made
212
- let expectation = self . expectation ( description: " No API call is made to merge user " )
213
+ let expectation2 = self . expectation ( description: " No API call is made to merge user " )
213
214
DispatchQueue . main. async {
214
215
if let _ = self . mockSession. getRequest ( withEndPoint: Const . Path. mergeUser) {
215
216
XCTFail ( " merge user API call was made unexpectedly " )
216
217
} else {
217
- expectation . fulfill ( )
218
+ expectation2 . fulfill ( )
218
219
}
219
220
}
220
221
@@ -250,19 +251,20 @@ class UserMergeScenariosTests: XCTestCase, AuthProvider {
250
251
}
251
252
waitForDuration ( seconds: 5 )
252
253
254
+ let expectation1 = self . expectation ( description: " Events properly cleared " )
253
255
if let events = localStorage. anonymousUserEvents {
254
256
XCTAssertFalse ( events. isEmpty, " Expected events to be logged " )
255
257
} else {
256
- XCTFail ( " Events were incorrectly cleared " )
258
+ expectation1 . fulfill ( )
257
259
}
258
260
259
261
// Verify "merge user" API call is not made
260
- let expectation = self . expectation ( description: " No API call is made to merge user " )
262
+ let expectation2 = self . expectation ( description: " No API call is made to merge user " )
261
263
DispatchQueue . main. async {
262
264
if let _ = self . mockSession. getRequest ( withEndPoint: Const . Path. mergeUser) {
263
265
XCTFail ( " merge user API call was made unexpectedly " )
264
266
} else {
265
- expectation . fulfill ( )
267
+ expectation2 . fulfill ( )
266
268
}
267
269
}
268
270
@@ -649,19 +651,20 @@ class UserMergeScenariosTests: XCTestCase, AuthProvider {
649
651
}
650
652
waitForDuration ( seconds: 5 )
651
653
654
+ let expectation1 = self . expectation ( description: " Events properly cleared " )
652
655
if let events = localStorage. anonymousUserEvents {
653
656
XCTAssertFalse ( events. isEmpty, " Expected events to be logged " )
654
657
} else {
655
- XCTFail ( " Events were incorrectly cleared " )
658
+ expectation1 . fulfill ( )
656
659
}
657
660
658
661
// Verify "merge user" API call is not made
659
- let expectation = self . expectation ( description: " No API call is made to merge user " )
662
+ let expectation2 = self . expectation ( description: " No API call is made to merge user " )
660
663
DispatchQueue . main. async {
661
664
if let _ = self . mockSession. getRequest ( withEndPoint: Const . Path. mergeUser) {
662
665
XCTFail ( " merge user API call was made unexpectedly " )
663
666
} else {
664
- expectation . fulfill ( )
667
+ expectation2 . fulfill ( )
665
668
}
666
669
}
667
670
@@ -695,19 +698,20 @@ class UserMergeScenariosTests: XCTestCase, AuthProvider {
695
698
}
696
699
waitForDuration ( seconds: 5 )
697
700
701
+ let expectation1 = self . expectation ( description: " Events properly cleared " )
698
702
if let events = localStorage. anonymousUserEvents {
699
703
XCTAssertFalse ( events. isEmpty, " Expected events to be logged " )
700
704
} else {
701
- XCTFail ( " Events were incorrectly cleared " )
705
+ expectation1 . fulfill ( )
702
706
}
703
707
704
708
// Verify "merge user" API call is not made
705
- let expectation = self . expectation ( description: " No API call is made to merge user " )
709
+ let expectation2 = self . expectation ( description: " No API call is made to merge user " )
706
710
DispatchQueue . main. async {
707
711
if let _ = self . mockSession. getRequest ( withEndPoint: Const . Path. mergeUser) {
708
712
XCTFail ( " merge user API call was made unexpectedly " )
709
713
} else {
710
- expectation . fulfill ( )
714
+ expectation2 . fulfill ( )
711
715
}
712
716
}
713
717
0 commit comments