Skip to content

Commit

Permalink
Add test for load next page if needed
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Apr 14, 2024
1 parent 89ce616 commit 4fdbdf3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion HarmonyTests/PlayerQueueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class PlayerQueueTests: XCTestCase {
Song(identifier: "2"),
Song(identifier: "3"),
]
let longSongResults = [ // Longer than default apge size
let longSongResults = [ // Longer than default page size, slightly shorter than double
Song(identifier: "1"),
Song(identifier: "2"),
Song(identifier: "3"),
Expand Down Expand Up @@ -381,4 +381,12 @@ final class PlayerQueueTests: XCTestCase {
XCTAssertTrue(playerQueue.futureSongs.isEmpty)
XCTAssertNil(playerQueue.currentSong)
}

@MainActor func testLoadNextPageIfNeeded() {
let startSong = longSongResults.first!
playerQueue.addCurrentSong(startSong, parentResults: longSongResults)
XCTAssertNotEqual(longSongResults.last, playerQueue.futureSongs.last?.song)
playerQueue.loadNextPageIfNeeded(song: playerQueue.futureSongs.last!)
XCTAssertEqual(longSongResults.last, playerQueue.futureSongs.last?.song)
}
}

0 comments on commit 4fdbdf3

Please sign in to comment.