Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Jul 25, 2024
1 parent f0b0fd8 commit e8332c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ final class AVPlayerExtensions: XCTestCase {
_ = observer.readyExpectation

let avPlayer = AVPlayer(playerItem: nil)
avPlayer.addObserver(observer, forKeyPath: "status", options: .new, context: nil)
avPlayer.replaceCurrentItem(withHls: VideoOptions(videoId: VideoId.validVideoId, videoType: .vod))
avPlayer.currentItem?.addObserver(observer, forKeyPath: "status", options: .new, context: nil)

avPlayer.play()

waitForExpectations(timeout: 10, handler: nil)
avPlayer.currentItem?.removeObserver(observer, forKeyPath: "status")
avPlayer.removeObserver(observer, forKeyPath: "status")
}

func testValidMP4VideoIdPlay() throws {
let observer = AVPlayerReadyObserverImpl(testCase: self)
_ = observer.readyExpectation

let avPlayer = AVPlayer(playerItem: nil)
avPlayer.addObserver(observer, forKeyPath: "status", options: .new, context: nil)
avPlayer.replaceCurrentItem(withMp4: VideoOptions(videoId: VideoId.validVideoId, videoType: .vod))
avPlayer.currentItem?.addObserver(observer, forKeyPath: "status", options: .new, context: nil)

avPlayer.play()

waitForExpectations(timeout: 10, handler: nil)
avPlayer.currentItem?.removeObserver(observer, forKeyPath: "status")
avPlayer.removeObserver(observer, forKeyPath: "status")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ final class ApiVideoPlayerControllerIntegrationTests: XCTestCase {

func testInvalidVideoId() throws {
let mockDelegate = MockedPlayerDelegate(testCase: self)
_ = mockDelegate.expectationReady(true)
_ = mockDelegate.expectationError()
let ready = mockDelegate.expectationReady(true)
let error = mockDelegate.expectationError()

let controller = ApiVideoPlayerController(
videoOptions: VideoOptions(videoId: VideoId.invalidVideoId, videoType: .vod),
delegates: [mockDelegate]
)

waitForExpectations(timeout: 5, handler: nil)
wait(for: [ready, error], timeout: 5)
}

@available(iOS 13.0, *)
Expand Down

0 comments on commit e8332c6

Please sign in to comment.