Skip to content

Commit 479bd73

Browse files
Fix flaky tests
1 parent ff39808 commit 479bd73

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

tests/unit-tests/InAppTests.swift

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,7 @@ class InAppTests: XCTestCase {
13631363
}
13641364

13651365
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)")
1366+
let expectation1 = expectation(description: "verify custom action is called, customActionScheme: \(customActionScheme), customActionName: \(customActionName)")
13681367

13691368
let mockInAppFetcher = MockInAppFetcher()
13701369

@@ -1377,7 +1376,7 @@ class InAppTests: XCTestCase {
13771376
let mockCustomActionDelegate = MockCustomActionDelegate(returnValue: true)
13781377
mockCustomActionDelegate.callback = { actionName, _ in
13791378
XCTAssertEqual(actionName, customActionName)
1380-
expectation2.fulfill()
1379+
expectation1.fulfill()
13811380
}
13821381

13831382
let config = IterableConfig()
@@ -1404,17 +1403,9 @@ class InAppTests: XCTestCase {
14041403
}
14051404
""".toJsonDict()
14061405

1407-
mockInAppFetcher.mockInAppPayloadFromServer(internalApi: internalApi, payload).onSuccess { [weak internalApi] _ in
1408-
guard let internalApi = internalApi else {
1409-
XCTFail("Expected internalApi to be not nil")
1410-
return
1411-
}
1412-
let messages = internalApi.inAppManager.getMessages()
1413-
XCTAssertEqual(messages.count, 1)
1414-
expectation1.fulfill()
1415-
}
1406+
mockInAppFetcher.mockInAppPayloadFromServer(internalApi: internalApi, payload)
14161407

1417-
wait(for: [expectation1, expectation2], timeout: testExpectationTimeout, enforceOrder: true)
1408+
wait(for: [expectation1], timeout: testExpectationTimeout)
14181409
}
14191410
}
14201411

0 commit comments

Comments
 (0)