Skip to content

Commit

Permalink
Merge pull request #657 from Iterable/test-remove-fix
Browse files Browse the repository at this point in the history
fixes testRemove unit test
  • Loading branch information
evantk91 authored Jul 7, 2023
2 parents 12b52dc + fa4fc2d commit 47f3fe8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/unit-tests/InboxTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,21 @@ class InboxTests: XCTestCase {
mockInAppFetcher.mockInAppPayloadFromServer(internalApi: internalAPI, payload).onSuccess { _ in
let messages = internalAPI.inAppManager.getInboxMessages()
XCTAssertEqual(messages.count, 2)

let messageToRemove = messages[0]
internalAPI.inAppManager.remove(
message: messageToRemove,
location: .inbox,
source: .inboxSwipe,
successHandler: { _ in
// Success handler code
expectation1.fulfill()
},
failureHandler: { _, _ in
// Failure handler code
XCTFail("Failed to remove message")
expectation1.fulfill()
}
successHandler: { _ in },
failureHandler: { _, _ in }
)

DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
let newMessages = internalAPI.inAppManager.getInboxMessages()
XCTAssertEqual(newMessages.count, 1)
expectation1.fulfill()
}
}

wait(for: [expectation1], timeout: testExpectationTimeout)
Expand Down

0 comments on commit 47f3fe8

Please sign in to comment.