From fe1ccc69661603d419a642a450e4ac9e1258adb0 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 19:44:44 -0500 Subject: fix: centralize URLs, tighten models, and polish SwiftUI bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add shared HutchDeepLinkURL constants for app, widgets, and tests. - Bump marketing version to 3.1.2 and build to 70 (app + widget extension). - Point Hutch stats default base URL at HutchStatsAPI; add SRHTWebURL status incident feed and reuse it from SystemStatusService. - Group Project into Metadata and Resources; split ContributionStatsResponse into StatsWindow and StatsTotals with updated decoding and tests. - Replace @Bindable usage with explicit Bindings in Profile, Projects list, and repository ACL flows; simplify Home pinned-item helper; add no-op bodies on cancel alert buttons where the compiler requires a statement. - Move repository row build-status indicator next to the relative-updated caption and reserve a fixed 8×8 slot so the row does not jump when status loads. - Use NSString.lastPathComponent for build artifact filenames; collapse duplicate ACL error branches; minor HutchStats HTTP and XMLParserDelegate cleanups. - Point widgets at HutchDeepLinkURL helpers; align tests with the new response and URL types. --- HutchTests/ProjectTests.swift | 135 ++++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 63 deletions(-) (limited to 'HutchTests/ProjectTests.swift') diff --git a/HutchTests/ProjectTests.swift b/HutchTests/ProjectTests.swift index eff800f..0323f25 100644 --- a/HutchTests/ProjectTests.swift +++ b/HutchTests/ProjectTests.swift @@ -3,52 +3,61 @@ import Testing @testable import Hutch struct ProjectTests { + private enum Fixture { + static let exampleWebsite = "https://example.com" + } + @Test func resourceSummaryIncludesCounts() { let project = Project( - id: "project-1", - name: "Hutch", - description: nil, - website: nil, - visibility: .public, - tags: [], - updated: Date(timeIntervalSince1970: 0), - mailingLists: [ - Project.MailingList( - id: "list-1", - name: "hutch-devel", - description: nil, - visibility: .public, - owner: Entity(canonicalName: "~owner") - ) - ], - sources: [ - Project.SourceRepo( - id: "repo-1", - name: "hutch", - description: nil, - visibility: .public, - owner: Entity(canonicalName: "~owner"), - repoType: .git - ), - Project.SourceRepo( - id: "repo-2", - name: "hutch-web", - description: nil, - visibility: .public, - owner: Entity(canonicalName: "~owner"), - repoType: .git - ) - ], - trackers: [ - Project.Tracker( - id: "tracker-1", - name: "bugs", - description: nil, - visibility: .public, - owner: Entity(canonicalName: "~owner") - ) - ] + metadata: .init( + id: "project-1", + name: "Hutch", + description: nil, + website: nil, + visibility: .public, + tags: [], + updated: Date(timeIntervalSince1970: 0) + ), + resources: .init( + mailingLists: [ + Project.MailingList( + id: "list-1", + name: "hutch-devel", + description: nil, + visibility: .public, + owner: Entity(canonicalName: "~owner") + ) + ], + sources: [ + Project.SourceRepo( + id: "repo-1", + name: "hutch", + description: nil, + visibility: .public, + owner: Entity(canonicalName: "~owner"), + repoType: .git + ), + Project.SourceRepo( + id: "repo-2", + name: "hutch-web", + description: nil, + visibility: .public, + owner: Entity(canonicalName: "~owner"), + repoType: .git + ) + ], + trackers: [ + Project.Tracker( + id: "tracker-1", + name: "bugs", + description: nil, + visibility: .public, + owner: Entity(canonicalName: "~owner") + ) + ], + isFullyLoaded: true + ) ) #expect(project.resourceSummary == "2 repos • 1 tracker • 1 list") @@ -57,16 +66,16 @@ struct ProjectTests { @Test func resourceSummaryFallsBackToWebsite() { let project = Project( - id: "project-1", - name: "Docs", - description: nil, - website: "https://example.com", - visibility: .public, - tags: [], - updated: Date(timeIntervalSince1970: 0), - mailingLists: [], - sources: [], - trackers: [] + metadata: .init( + id: "project-1", + name: "Docs", + description: nil, + website: Fixture.exampleWebsite, + visibility: .public, + tags: [], + updated: Date(timeIntervalSince1970: 0) + ), + resources: .init(mailingLists: [], sources: [], trackers: [], isFullyLoaded: true) ) #expect(project.resourceSummary == "Website linked") @@ -75,16 +84,16 @@ struct ProjectTests { @Test func displayHelpersNormalizeBlankValues() { let project = Project( - id: "project-1", - name: " ", - description: "\n", - website: "https://example.com", - visibility: .unlisted, - tags: [" docs ", "", "Docs", "ios"], - updated: Date(timeIntervalSince1970: 0), - mailingLists: [], - sources: [], - trackers: [] + metadata: .init( + id: "project-1", + name: " ", + description: "\n", + website: Fixture.exampleWebsite, + visibility: .unlisted, + tags: [" docs ", "", "Docs", "ios"], + updated: Date(timeIntervalSince1970: 0) + ), + resources: .init(mailingLists: [], sources: [], trackers: [], isFullyLoaded: true) ) #expect(project.displayName == "Untitled Project") -- cgit v1.2.3