summaryrefslogtreecommitdiff
path: root/SoraTests/ViewDerivedDataTests.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-22 13:51:50 +0000
committerFuwn <[email protected]>2026-03-22 14:02:13 +0000
commit8e5eac4566c5677f57d017e232a69a0e14308540 (patch)
tree01ea4468e0c79681e69976e48295828275184ad3 /SoraTests/ViewDerivedDataTests.swift
parentfix: send booru headers for image requests (diff)
downloadsora-testing-8e5eac4566c5677f57d017e232a69a0e14308540.tar.xz
sora-testing-8e5eac4566c5677f57d017e232a69a0e14308540.zip
fix: repair moebooru tag suggestions
Diffstat (limited to 'SoraTests/ViewDerivedDataTests.swift')
-rw-r--r--SoraTests/ViewDerivedDataTests.swift29
1 files changed, 29 insertions, 0 deletions
diff --git a/SoraTests/ViewDerivedDataTests.swift b/SoraTests/ViewDerivedDataTests.swift
index f737e1a..ba02145 100644
--- a/SoraTests/ViewDerivedDataTests.swift
+++ b/SoraTests/ViewDerivedDataTests.swift
@@ -1083,6 +1083,35 @@ final class ViewDerivedDataTests: XCTestCase { // swiftlint:disable:this type_b
)
}
+ func testBooruManagerMoebooruTagSuggestionsUseNameQuery() throws {
+ let source = try loadSource(at: "Sora/Data/Booru/BooruManager.swift")
+ let tagSearchSection = try extractFunction(
+ named: "private func url(forTagsSearch name: String) -> URL?",
+ from: source
+ )
+ let moebooruNameQueryCount = tokenCount(
+ matching: #"case\s+\.moebooru:\s*[\s\S]*?URLQueryItem\(name:\s*"name",\s*value:\s*name\)"#,
+ in: tagSearchSection
+ )
+ let functionNamePatternQueryCount = tokenCount(
+ matching: #"URLQueryItem\(name:\s*"name_pattern""#,
+ in: tagSearchSection
+ )
+
+ // swiftlint:disable:next prefer_nimble
+ XCTAssertGreaterThan(
+ moebooruNameQueryCount,
+ 0,
+ "Moebooru tag suggestions should query with `name` so supported providers return filtered matches."
+ )
+ // swiftlint:disable:next prefer_nimble
+ XCTAssertEqual(
+ functionNamePatternQueryCount,
+ 1,
+ "Only the Gelbooru tag-suggestion branch should still use `name_pattern`."
+ )
+ }
+
func testBooruRequestConfigurationSupportsOptionalAndCustomUserAgentHeaders() throws {
let source = try loadSource(at: "Sora/Data/Booru/BooruRequestConfiguration.swift")
let userAgentResolverSection = try extractFunction(