-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MOB-6632] [MOB-6633] [MOB-6634] [MOB-6636] Add Iterable embedded manager unit tests #670
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really great. Added some comments for my own clarity.
manager.syncMessages { } | ||
|
||
XCTAssertTrue(delegate1Called, "Delegate 1 should have been notified.") | ||
XCTAssertTrue(delegate2Called, "Delegate 2 should have been notified.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful test case!
]) | ||
manager.syncMessages { } | ||
|
||
XCTAssertFalse(delegateCalled, "Delegate should not have been notified after being removed.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
|
||
override func getEmbeddedMessages() -> IterableSDK.Pending<IterableSDK.PlacementsPayload, IterableSDK.SendRequestError> { | ||
if invalidApiKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little confused here. Does the actual getMessages not get called in the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ayyanchira if we didn't override getEmbeddedMessages(), the test would attempt to call the API. As this is only a unit test (and not an endpoint test), we don't want to make actual API calls, as that could introduce flakiness and external dependency.
🔹 Jira Ticket(s)
✏️ Description
Had to make a couple minor adjustments to the actual manager to add/remove forerground notification observers (they hadn't been implemented yet), and to add onDeinit closure, which we can then observe in tests.