diff --git a/Tests/PlayerTests/Playlist/CurrentItemTests.swift b/Tests/PlayerTests/Playlist/CurrentItemTests.swift index 72079426..adcf0032 100644 --- a/Tests/PlayerTests/Playlist/CurrentItemTests.swift +++ b/Tests/PlayerTests/Playlist/CurrentItemTests.swift @@ -42,13 +42,15 @@ final class CurrentItemTests: TestCase { let item2 = PlayerItem.simple(url: Stream.unavailable.url) let item3 = PlayerItem.simple(url: Stream.shortOnDemand.url) let player = Player(items: [item1, item2, item3]) - expectEqualPublished( + let publisher = player.changePublisher(at: \.currentItem).removeDuplicates() + expectAtLeastEqualPublished( values: [item1, item2], - from: player.changePublisher(at: \.currentItem).removeDuplicates(), - during: .seconds(2) + from: publisher ) { player.play() } + + expectNothingPublishedNext(from: publisher, during: .seconds(1)) } func testCurrentItemWithLastFailedItem() { diff --git a/Tests/PlayerTests/ProgressTracker/ProgressTrackerProgressTests.swift b/Tests/PlayerTests/ProgressTracker/ProgressTrackerProgressTests.swift index 559fb6f6..737ee262 100644 --- a/Tests/PlayerTests/ProgressTracker/ProgressTrackerProgressTests.swift +++ b/Tests/PlayerTests/ProgressTracker/ProgressTrackerProgressTests.swift @@ -50,16 +50,18 @@ final class ProgressTrackerProgressTests: TestCase { let progressTracker = ProgressTracker(interval: CMTime(value: 1, timescale: 4)) let item = PlayerItem.simple(url: Stream.shortOnDemand.url) let player = Player(item: item) - expectPublished( + let publisher = progressTracker.changePublisher(at: \.progress) + .removeDuplicates() + expectAtLeastPublished( values: [0, 0.25, 0.5, 0.75, 1, 0], - from: progressTracker.changePublisher(at: \.progress) - .removeDuplicates(), - to: beClose(within: 0.1), - during: .seconds(2) + from: publisher, + to: beClose(within: 0.1) ) { progressTracker.player = player player.play() } + + expectNothingPublishedNext(from: publisher, during: .seconds(1)) } func testPausedDvrStream() { diff --git a/Tests/PlayerTests/Tracking/PlayerItemTrackerMetricPublisherTests.swift b/Tests/PlayerTests/Tracking/PlayerItemTrackerMetricPublisherTests.swift index 6d9895fa..57ff7142 100644 --- a/Tests/PlayerTests/Tracking/PlayerItemTrackerMetricPublisherTests.swift +++ b/Tests/PlayerTests/Tracking/PlayerItemTrackerMetricPublisherTests.swift @@ -38,17 +38,19 @@ final class PlayerItemTrackerMetricPublisherTests: TestCase { func testPlaylist() { let player = Player(items: [.simple(url: Stream.shortOnDemand.url), .simple(url: Stream.mediumOnDemand.url)]) - expectSimilarPublished( + let publisher = player.metricEventsPublisher + expectAtLeastSimilarPublished( values: [ [], [.anyMetadata], [.anyMetadata, .anyAsset], [.anyMetadata, .anyAsset] ], - from: player.metricEventsPublisher, - during: .seconds(2) + from: publisher ) { player.play() } + + expectNothingPublishedNext(from: publisher, during: .seconds(1)) } }