Skip to content

Commit

Permalink
Add testing for files backend scan with broken song
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Apr 9, 2024
1 parent 2eaf615 commit e850ca3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion HarmonyKitTests/Backend/Files/FilesBackendTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,24 @@ class FilesBackendTests: XCTestCase {
}
}

// TODO: Test busted songs
func testRecursiveScanWithBrokenSong() async {
do {
try createTemporaryDirectoryStructure()
let brokenFile = temporaryDirectory.appendingPathComponent("brokenFile.mp3")
try Data().write(to: brokenFile)

let backend = FilesBackend(path: temporaryDirectory, backendId: "test-backend")
try await backend.scan(
containerScanApprover: { _,_ in return true },
songScanApprover: { _,_ in return true },
finalisedSongHandler: { song in self.songs.append(song) },
finalisedContainerHandler: { _,_ in }
)
XCTAssertEqual(songs.count, 2, "Expected 2 audio files, third file is not valid")
} catch {
XCTFail("Error creating nested directory structure: \(error)")
}
}

func testRecursiveScanTime() throws {
try createTemporaryDirectoryStructure()
Expand Down

0 comments on commit e850ca3

Please sign in to comment.