Skip to content

Commit e8332c6

Browse files
committed
test
1 parent f0b0fd8 commit e8332c6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Tests/ApiVideoPlayerTests/IntegrationTests/AVPlayerExtensionsTests.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,27 @@ final class AVPlayerExtensions: XCTestCase {
1010
_ = observer.readyExpectation
1111

1212
let avPlayer = AVPlayer(playerItem: nil)
13+
avPlayer.addObserver(observer, forKeyPath: "status", options: .new, context: nil)
1314
avPlayer.replaceCurrentItem(withHls: VideoOptions(videoId: VideoId.validVideoId, videoType: .vod))
14-
avPlayer.currentItem?.addObserver(observer, forKeyPath: "status", options: .new, context: nil)
15+
1516
avPlayer.play()
1617

1718
waitForExpectations(timeout: 10, handler: nil)
18-
avPlayer.currentItem?.removeObserver(observer, forKeyPath: "status")
19+
avPlayer.removeObserver(observer, forKeyPath: "status")
1920
}
2021

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

2526
let avPlayer = AVPlayer(playerItem: nil)
27+
avPlayer.addObserver(observer, forKeyPath: "status", options: .new, context: nil)
2628
avPlayer.replaceCurrentItem(withMp4: VideoOptions(videoId: VideoId.validVideoId, videoType: .vod))
27-
avPlayer.currentItem?.addObserver(observer, forKeyPath: "status", options: .new, context: nil)
29+
2830
avPlayer.play()
2931

3032
waitForExpectations(timeout: 10, handler: nil)
31-
avPlayer.currentItem?.removeObserver(observer, forKeyPath: "status")
33+
avPlayer.removeObserver(observer, forKeyPath: "status")
3234
}
3335
}
3436

Tests/ApiVideoPlayerTests/IntegrationTests/ApiVideoPlayerControllerIntegrationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ final class ApiVideoPlayerControllerIntegrationTests: XCTestCase {
112112

113113
func testInvalidVideoId() throws {
114114
let mockDelegate = MockedPlayerDelegate(testCase: self)
115-
_ = mockDelegate.expectationReady(true)
116-
_ = mockDelegate.expectationError()
115+
let ready = mockDelegate.expectationReady(true)
116+
let error = mockDelegate.expectationError()
117117

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

123-
waitForExpectations(timeout: 5, handler: nil)
123+
wait(for: [ready, error], timeout: 5)
124124
}
125125

126126
@available(iOS 13.0, *)

0 commit comments

Comments
 (0)