Skip to content

Commit

Permalink
test: Configurable document load delay for preview repo
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Jun 9, 2024
1 parent 1301ab1 commit f50e9e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions swift-paperless/PreviewRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ actor PreviewRepository: Repository {
private let storagePaths: [UInt: StoragePath]
private let tasks: [PaperlessTask]

init() {
private let downloadDelay: Double

init(downloadDelay: Double = 0.0) {
self.downloadDelay = downloadDelay

let tags = [Tag]([
.init(id: 1, isInboxTag: true, name: "Inbox", slug: "inbox", color: Color.purple.hex, match: "", matchingAlgorithm: .auto, isInsensitive: true),
.init(id: 2, isInboxTag: false, name: "Bank", slug: "bank", color: Color.blue.hex, match: "", matchingAlgorithm: .auto, isInsensitive: true),
Expand Down Expand Up @@ -200,7 +204,7 @@ actor PreviewRepository: Repository {
func create(document _: ProtoDocument, file _: URL) async throws {}

func download(documentID _: UInt) async -> URL? {
try? await Task.sleep(for: .seconds(10))
try? await Task.sleep(for: .seconds(downloadDelay))
return Bundle.main.url(forResource: "demo2", withExtension: "pdf")
}

Expand Down

0 comments on commit f50e9e9

Please sign in to comment.