summaryrefslogtreecommitdiff
path: root/HutchTests/SRHTClientTests.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-13 14:20:27 -0500
committerChristian Cleberg <[email protected]>2026-04-13 14:20:27 -0500
commit5e63048ab6a741ae947f7fe42efcb5206a3f3963 (patch)
treecf8eb2e3bc3b2edb20ef96a2599e684378120e5b /HutchTests/SRHTClientTests.swift
parent0b84ecaf7ba0fb2cd3f3867da8dc732450b55b50 (diff)
downloadhutch-5e63048ab6a741ae947f7fe42efcb5206a3f3963.tar.gz
hutch-5e63048ab6a741ae947f7fe42efcb5206a3f3963.tar.bz2
hutch-5e63048ab6a741ae947f7fe42efcb5206a3f3963.zip
fix: mercurial parity and graphql handlingv3.0.4
- implements consistent UX between repo types - ensures centralized services and routes are used between repo types - graphql error handling is centralized - error messages are consistent Implements: https://todo.sr.ht/~ccleberg/hutch/58 Implements: https://todo.sr.ht/~ccleberg/hutch/59
Diffstat (limited to 'HutchTests/SRHTClientTests.swift')
-rw-r--r--HutchTests/SRHTClientTests.swift29
1 files changed, 29 insertions, 0 deletions
diff --git a/HutchTests/SRHTClientTests.swift b/HutchTests/SRHTClientTests.swift
index 2ce2529..12d6d0f 100644
--- a/HutchTests/SRHTClientTests.swift
+++ b/HutchTests/SRHTClientTests.swift
@@ -24,4 +24,33 @@ struct SRHTClientTests {
Issue.record("Expected SRHTError.invalidAuthenticatedURL, got \(error).")
}
}
+
+ @Test
+ func graphQLErrorUserFacingMessagePreservesValidationDetails() {
+ let error = SRHTError.graphQLErrors([
+ GraphQLError(message: "A tracker named bugs already exists", locations: nil)
+ ])
+
+ #expect(error.userFacingMessage == "A tracker named bugs already exists")
+ }
+
+ @Test
+ func graphQLErrorUserFacingMessageClassifiesNotFoundResponses() {
+ let error = SRHTError.graphQLErrors([
+ GraphQLError(message: "reference not found", locations: nil)
+ ])
+
+ #expect(error.userFacingMessage == "That content is no longer available.")
+ #expect(error.matchesGraphQLErrorClassification(.missingReference))
+ }
+
+ @Test
+ func graphQLErrorUserFacingMessageClassifiesServiceProvisioningFailures() {
+ let error = SRHTError.graphQLErrors([
+ GraphQLError(message: "No such repository or user found", locations: nil)
+ ])
+
+ #expect(error.userFacingMessage == "That account needs to activate this SourceHut service before this action can succeed.")
+ #expect(error.matchesGraphQLErrorClassification(.serviceNotProvisioned))
+ }
}