Skip to content

Commit

Permalink
Add test for video where all the streams are playable
Browse files Browse the repository at this point in the history
  • Loading branch information
SoneeJohn committed Feb 17, 2020
1 parent 3519369 commit c41011d
Show file tree
Hide file tree
Showing 2 changed files with 530 additions and 0 deletions.

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions XCDYouTubeKit Tests/XCDYouTubeClientTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,34 @@ - (void) testVideo1ReturnsNoPlayableStreamsBecauseConnectionError_offline
[self waitForExpectationsWithTimeout:5 handler:nil];
}

- (void) testVideo2ReturnsAllPlayableStreams
{
__weak XCTestExpectation *expectation = [self expectationWithDescription:@""];
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:@"QcIy9NiNbmo" completionHandler:^(XCDYouTubeVideo *video, NSError *error)
{
XCTAssertNotNil(video);
XCTAssertNil(error);

[[XCDYouTubeClient defaultClient]queryVideo:video cookies:nil completionHandler:^(NSDictionary * _Nonnull streamURLs, NSError * _Nullable queryError, NSDictionary<id, NSError *> *streamErrors) {

XCTAssertNil(queryError);
XCTAssertNil(streamErrors);
XCTAssertNotNil(streamURLs);

for (id key in streamURLs.allKeys)
{
XCTAssertNotNil(streamURLs[key]);
}

XCTAssertEqual(video.streamURLs.count, streamURLs.count, @"`streamURLs` count should be equal since all the streams are playable.");

[expectation fulfill];
}];
}];

[self waitForExpectationsWithTimeout:90 handler:nil];
}

- (void) testExpiredLiveVideo
{
__weak XCTestExpectation *expectation = [self expectationWithDescription:@""];
Expand Down

0 comments on commit c41011d

Please sign in to comment.