Skip to content

Commit 3c0e5d0

Browse files
LP-10041: Murka support multiple messages for same priority and show only 1 for same priority and time (#250)
cleanup more Unit test cases remove unncessary check
1 parent 213c74c commit 3c0e5d0

File tree

3 files changed

+901
-785
lines changed

3 files changed

+901
-785
lines changed

Example/Tests/Classes/LeanplumTest.m

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,51 @@ - (void) test_user_attributes
728728
}
729729

730730
/**
731-
* Tests all track methods.
731+
* Tests track with events of same type , priority and countdown.
732+
*/
733+
- (void) test_track_events_priority_countDown
734+
{
735+
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) {
736+
return [request.URL.host isEqualToString:API_HOST];
737+
} withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) {
738+
NSString *response_file = OHPathForFile(@"simple_start_response.json", self.class);
739+
return [OHHTTPStubsResponse responseWithFileAtPath:response_file statusCode:200
740+
headers:@{@"Content-Type":@"application/json"}];
741+
}];
742+
743+
XCTAssertTrue([LeanplumHelper start_development_test]);
744+
745+
// Sample track params.
746+
NSString *trackName = @"pushLocal";
747+
748+
// Validate track request.
749+
[LeanplumRequest validate_request:^BOOL(NSString *method, NSString *apiMethod,
750+
NSDictionary *params) {
751+
// Check api method first.
752+
XCTAssertEqualObjects(apiMethod, @"track");
753+
XCTAssertTrue([params[@"event"] isEqualToString:trackName]);
754+
XCTAssertNotNil(params[@"event"]);
755+
return YES;
756+
}];
757+
NSString *messageIdOne = @"4982955628167168";
758+
NSString *messageIdSecond = @"5571264209354752";
759+
[LeanplumRequest validate_onResponse:^(id<LPNetworkOperationProtocol> operation, id json) {
760+
NSDictionary *outputDict = json[@"messages"];
761+
XCTAssertNotNil(outputDict);
762+
XCTAssertEqual([[outputDict allKeys] count], 2, @"Wrong array size.");
763+
XCTAssertNotNil(outputDict[messageIdOne]);
764+
XCTAssertNotNil(outputDict[messageIdSecond]);
765+
XCTAssertEqual(outputDict[messageIdOne][@"priority"], outputDict[messageIdOne][@"priority"], @"Priority not Equal");
766+
XCTAssertEqual(outputDict[messageIdOne][@"countdown"], outputDict[messageIdOne][@"countdown"], @"Countdown not Equal");
767+
}];
768+
[Leanplum track:trackName];
769+
[Leanplum forceContentUpdate];
770+
XCTAssertTrue([Leanplum hasStarted]);
771+
772+
}
773+
774+
/**
775+
* Tests track methods.
732776
*/
733777
- (void) test_track
734778
{

0 commit comments

Comments
 (0)