Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[MB-1086] more tests
  • Loading branch information
marc-scig committed Apr 9, 2015
1 parent 476e4ed commit 7525f02
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions AirshipLib/AirshipLogicTests/UAInAppMessagingTest.m
Expand Up @@ -36,6 +36,7 @@ - (void)setUp {
[[[self.mockMessageController stub] andReturn:self.mockMessageController] controllerWithMessage:[OCMArg any] delegate:[OCMArg any] dismissalBlock:[OCMArg any]];

self.bannerMessage = [UAInAppMessage message];
self.bannerMessage.identifier = @"identifier";
self.bannerMessage.alert = @"whatever";
self.bannerMessage.displayType = UAInAppMessageDisplayTypeBanner;
self.bannerMessage.expiry = [NSDate dateWithTimeIntervalSinceNow:10000];
Expand Down Expand Up @@ -124,6 +125,21 @@ - (void)testAutoDisplayEnabled {
XCTAssertFalse(self.inAppMessaging.isAutoDisplayEnabled);
}

/**
* Test that an event is added only if the messge is actually displayed
*/
- (void)testSendDisplayEventIfDisplayed {
[(UAInAppMessageController *)[[self.mockMessageController stub] andReturnValue:OCMOCK_VALUE(YES)] show];

[[self.mockAnalytics expect] addEvent:[OCMArg any]];
[self.inAppMessaging displayMessage:self.bannerMessage];

[self. mockAnalytics verify];

[(UAInAppMessageController *)[[self.mockMessageController stub] andReturnValue:OCMOCK_VALUE(NO)] show];
[[self.mockAnalytics reject] addEvent:[OCMArg any]];
[self. mockAnalytics verify];
}


@end

0 comments on commit 7525f02

Please sign in to comment.