@@ -560,21 +560,15 @@ class InAppTests: XCTestCase {
560
560
func testShowInAppWithCustomActionBackwardCompatibility( ) {
561
561
let customActionScheme = " itbl "
562
562
let customActionName = " my_custom_action "
563
- let expectation1 = expectation ( description: " verify custom action is called, customActionScheme: \( customActionScheme) , customActionName: \( customActionName) " )
564
- verifyCustomActionIsCalled ( expectation1: expectation1,
565
- customActionScheme: customActionScheme,
563
+ verifyCustomActionIsCalled ( customActionScheme: customActionScheme,
566
564
customActionName: customActionName)
567
- wait ( for: [ expectation1] , timeout: testExpectationTimeout)
568
565
}
569
566
570
567
func testShowInAppWithCustomAction1( ) {
571
568
let customActionScheme = " action "
572
569
let customActionName = " my_custom_action "
573
- let expectation1 = expectation ( description: " verify custom action is called, customActionScheme: \( customActionScheme) , customActionName: \( customActionName) " )
574
- verifyCustomActionIsCalled ( expectation1: expectation1,
575
- customActionScheme: customActionScheme,
570
+ verifyCustomActionIsCalled ( customActionScheme: customActionScheme,
576
571
customActionName: customActionName)
577
- wait ( for: [ expectation1] , timeout: testExpectationTimeout)
578
572
}
579
573
580
574
// Check that onNew is called just once if the messageId is same.
@@ -1368,8 +1362,9 @@ class InAppTests: XCTestCase {
1368
1362
wait ( for: [ expectation1] , timeout: testExpectationTimeout)
1369
1363
}
1370
1364
1371
- fileprivate func verifyCustomActionIsCalled( expectation1: XCTestExpectation , customActionScheme: String , customActionName: String ) {
1372
- let expectation2 = expectation ( description: " correct number of messages " )
1365
+ fileprivate func verifyCustomActionIsCalled( customActionScheme: String , customActionName: String ) {
1366
+ let expectation1 = expectation ( description: " ensure correct number of messages " )
1367
+ let expectation2 = expectation ( description: " verify custom action is called, customActionScheme: \( customActionScheme) , customActionName: \( customActionName) " )
1373
1368
1374
1369
let mockInAppFetcher = MockInAppFetcher ( )
1375
1370
@@ -1382,7 +1377,7 @@ class InAppTests: XCTestCase {
1382
1377
let mockCustomActionDelegate = MockCustomActionDelegate ( returnValue: true )
1383
1378
mockCustomActionDelegate. callback = { actionName, _ in
1384
1379
XCTAssertEqual ( actionName, customActionName)
1385
- expectation1 . fulfill ( )
1380
+ expectation2 . fulfill ( )
1386
1381
}
1387
1382
1388
1383
let config = IterableConfig ( )
@@ -1416,10 +1411,10 @@ class InAppTests: XCTestCase {
1416
1411
}
1417
1412
let messages = internalApi. inAppManager. getMessages ( )
1418
1413
XCTAssertEqual ( messages. count, 1 )
1419
- expectation2 . fulfill ( )
1414
+ expectation1 . fulfill ( )
1420
1415
}
1421
1416
1422
- wait ( for: [ expectation2] , timeout: testExpectationTimeout)
1417
+ wait ( for: [ expectation1 , expectation2] , timeout: testExpectationTimeout, enforceOrder : true )
1423
1418
}
1424
1419
}
1425
1420
0 commit comments