@@ -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