diff --git a/RNTesterUnitTests/RCTMultipartStreamReaderTests.m b/RNTesterUnitTests/RCTMultipartStreamReaderTests.m index 20df842757a..c92a505a9ec 100644 --- a/RNTesterUnitTests/RCTMultipartStreamReaderTests.m +++ b/RNTesterUnitTests/RCTMultipartStreamReaderTests.m @@ -31,12 +31,12 @@ - (void)testSimpleCase { NSInputStream *inputStream = [NSInputStream inputStreamWithData:[response dataUsingEncoding:NSUTF8StringEncoding]]; RCTMultipartStreamReader *reader = [[RCTMultipartStreamReader alloc] initWithInputStream:inputStream boundary:@"sample_boundary"]; __block NSInteger count = 0; - BOOL success = [reader readAllParts:^(NSDictionary *headers, NSData *content, BOOL done) { + BOOL success = [reader readAllPartsWithCompletionCallback:^(NSDictionary *headers, NSData *content, BOOL done) { XCTAssertTrue(done); XCTAssertEqualObjects(headers[@"Content-Type"], @"application/json; charset=utf-8"); XCTAssertEqualObjects([[NSString alloc] initWithData:content encoding:NSUTF8StringEncoding], @"{}"); count++; - }]; + } progressCallback: nil]; XCTAssertTrue(success); XCTAssertEqual(count, 1); } @@ -56,13 +56,13 @@ - (void)testMultipleParts { NSInputStream *inputStream = [NSInputStream inputStreamWithData:[response dataUsingEncoding:NSUTF8StringEncoding]]; RCTMultipartStreamReader *reader = [[RCTMultipartStreamReader alloc] initWithInputStream:inputStream boundary:@"sample_boundary"]; __block NSInteger count = 0; - BOOL success = [reader readAllParts:^(__unused NSDictionary *headers, NSData *content, BOOL done) { + BOOL success = [reader readAllPartsWithCompletionCallback:^(__unused NSDictionary *headers, NSData *content, BOOL done) { count++; XCTAssertEqual(done, count == 3); NSString *expectedBody = [NSString stringWithFormat:@"%ld", (long)count]; NSString *actualBody = [[NSString alloc] initWithData:content encoding:NSUTF8StringEncoding]; XCTAssertEqualObjects(actualBody, expectedBody); - }]; + } progressCallback:nil]; XCTAssertTrue(success); XCTAssertEqual(count, 3); } @@ -73,9 +73,9 @@ - (void)testNoDelimiter { NSInputStream *inputStream = [NSInputStream inputStreamWithData:[response dataUsingEncoding:NSUTF8StringEncoding]]; RCTMultipartStreamReader *reader = [[RCTMultipartStreamReader alloc] initWithInputStream:inputStream boundary:@"sample_boundary"]; __block NSInteger count = 0; - BOOL success = [reader readAllParts:^(__unused NSDictionary *headers, __unused NSData *content, __unused BOOL done) { + BOOL success = [reader readAllPartsWithCompletionCallback:^(__unused NSDictionary *headers, __unused NSData *content, __unused BOOL done) { count++; - }]; + } progressCallback:nil]; XCTAssertFalse(success); XCTAssertEqual(count, 0); } @@ -93,9 +93,9 @@ - (void)testNoCloseDelimiter { NSInputStream *inputStream = [NSInputStream inputStreamWithData:[response dataUsingEncoding:NSUTF8StringEncoding]]; RCTMultipartStreamReader *reader = [[RCTMultipartStreamReader alloc] initWithInputStream:inputStream boundary:@"sample_boundary"]; __block NSInteger count = 0; - BOOL success = [reader readAllParts:^(__unused NSDictionary *headers, __unused NSData *content, __unused BOOL done) { + BOOL success = [reader readAllPartsWithCompletionCallback:^(__unused NSDictionary *headers, __unused NSData *content, __unused BOOL done) { count++; - }]; + } progressCallback:nil]; XCTAssertFalse(success); XCTAssertEqual(count, 1); }