feat: open-source 小浣熊阅读 for iOS

This commit is contained in:
Aminark
2026-10-14 11:37:36 +08:00
commit ffc9e9d91d
193 changed files with 41382 additions and 0 deletions
@@ -0,0 +1,21 @@
import Foundation
import Testing
@testable import LegadoCore
struct BookRepositoryTests {
@Test func persistsBooksAtomically() async throws {
let directory = FileManager.default.temporaryDirectory
.appending(path: UUID().uuidString, directoryHint: .isDirectory)
let fileURL = directory.appending(path: "books.json")
defer { try? FileManager.default.removeItem(at: directory) }
let repository = FileBookRepository(fileURL: fileURL)
var book = Book(bookUrl: "https://example.test/book/1", name: "测试书", author: "作者", origin: "https://example.test")
book.durChapterIndex = 3
try await repository.save([book])
let restored = try await repository.load()
#expect(restored == [book])
#expect(restored.first?.durChapterIndex == 3)
}
}