Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu committed Jul 10, 2024
1 parent ce78cb3 commit 5b41ea9
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 566 deletions.
4 changes: 2 additions & 2 deletions Sources/Shared/Toolkit/File/FileContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class FileContainer: Container, Loggable {
/// Provides access to a collection of local files.
public init(files: [RelativeURL: FileURL]) {
self.files = files
entries = Set(files.keys.map(\.anyURL))
entries = Set(files.keys.map(\.anyURL.normalized))
}

/// Provides access to the given local `file` at `href`.
Expand All @@ -26,7 +26,7 @@ public final class FileContainer: Container, Loggable {

public subscript(url: any URLConvertible) -> Resource? {
guard
let url = url.relativeURL,
let url = url.relativeURL?.normalized,
let file = files[url]
else {
return nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/Streamer/Parser/Audio/AudioParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public final class AudioParser: PublicationParser {
makeBuilder(
container: asset.container,
readingOrder: readingOrder,
title: asset.container.guessTitle()
title: asset.container.guessTitle(ignoring: ignores)
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Streamer/Parser/Image/ImageParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public final class ImageParser: PublicationParser {
makeBuilder(
container: asset.container,
readingOrder: readingOrder,
title: asset.container.guessTitle()
title: asset.container.guessTitle(ignoring: ignores)
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Streamer/Toolkit/Extensions/Container.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ extension Container {
///
/// If the HREFs contain a single root directory, we assume it is the
/// title. This is often the case for example with CBZ files.
func guessTitle() -> String? {
func guessTitle(ignoring: (AnyURL) -> Bool = { _ in false }) -> String? {
var title: String?

for url in entries {
if url.lastPathSegment?.hasPrefix(".") == true || url.lastPathSegment == "Thumbs.db" {
if ignoring(url) {
continue
}
let segments = url.pathSegments
Expand Down
116 changes: 0 additions & 116 deletions Tests/SharedTests/Fetcher/ArchiveFetcherTests.swift

This file was deleted.

103 changes: 0 additions & 103 deletions Tests/SharedTests/Fetcher/FileFetcherTests.swift

This file was deleted.

Empty file.

This file was deleted.

1 change: 0 additions & 1 deletion Tests/SharedTests/Fixtures/Fetcher/directory/text1.txt

This file was deleted.

1 change: 0 additions & 1 deletion Tests/SharedTests/Fixtures/Fetcher/text.txt

This file was deleted.

1 change: 1 addition & 0 deletions Tests/SharedTests/ProxyContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ final class ProxyContainer: Container {
self.retrieve = retrieve
}

let sourceURL: AbsoluteURL? = nil
let entries: Set<AnyURL>

subscript(url: any URLConvertible) -> (any Resource)? {
Expand Down
28 changes: 0 additions & 28 deletions Tests/SharedTests/Publication/Asset/FileAssetTests.swift

This file was deleted.

Loading

0 comments on commit 5b41ea9

Please sign in to comment.