Skip to content

Commit

Permalink
fixes testRemove unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
evan.greer@iterable.com committed Jul 7, 2023
1 parent 12b52dc commit fa4fc2d
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 fa4fc2d

Please sign in to comment.