summaryrefslogtreecommitdiff
path: root/HutchTests/BundleUserAgentTests.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-19 15:46:38 -0500
committerChristian Cleberg <[email protected]>2026-04-19 15:46:38 -0500
commit3272d0674dedf8cc864c50e6bdc430b26d5fbba6 (patch)
treeafd73f46a9be19b20dd3628d78bf903610b5d8eb /HutchTests/BundleUserAgentTests.swift
parent2199384f887cf5634f3fdcf651eeb9c2c7ed457a (diff)
downloadhutch-3.1.11.tar.gz
hutch-3.1.11.tar.bz2
hutch-3.1.11.zip
fix: Sonar issues in BundleUserAgentTests and accept README URL path joinv3.1.11
Diffstat (limited to 'HutchTests/BundleUserAgentTests.swift')
-rw-r--r--HutchTests/BundleUserAgentTests.swift10
1 files changed, 6 insertions, 4 deletions
diff --git a/HutchTests/BundleUserAgentTests.swift b/HutchTests/BundleUserAgentTests.swift
index b2f701b..c1a20b8 100644
--- a/HutchTests/BundleUserAgentTests.swift
+++ b/HutchTests/BundleUserAgentTests.swift
@@ -9,7 +9,7 @@ import Testing
private final class CapturingURLProtocol: URLProtocol, @unchecked Sendable {
nonisolated(unsafe) static var capturedRequests: [URLRequest] = []
- override class func canInit(with request: URLRequest) -> Bool { true }
+ override class func canInit(with _: URLRequest) -> Bool { true }
override class func canonicalRequest(for request: URLRequest) -> URLRequest { request }
override func startLoading() {
@@ -25,7 +25,9 @@ private final class CapturingURLProtocol: URLProtocol, @unchecked Sendable {
client?.urlProtocolDidFinishLoading(self)
}
- override func stopLoading() {}
+ override func stopLoading() {
+ // No cleanup is needed because the stub responds immediately in `startLoading()`.
+ }
static func makeSession() -> URLSession {
let config = URLSessionConfiguration.ephemeral
@@ -79,10 +81,10 @@ struct BundleUserAgentTests {
}
@Test
- func sRHTClientSetsUserAgentOnFetchText() async {
+ func sRHTClientSetsUserAgentOnFetchText() async throws {
CapturingURLProtocol.capturedRequests = []
let client = SRHTClient(session: CapturingURLProtocol.makeSession(), token: "test-token")
- let url = try! #require(URL(string: "https://builds.sr.ht/~test/job/1/log"))
+ let url = try #require(URL(string: "https://builds.sr.ht/~test/job/1/log"))
_ = try? await client.fetchText(url: url)