summaryrefslogtreecommitdiff
path: root/HutchTests/ProjectTests.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-13 19:44:44 -0500
committerChristian Cleberg <[email protected]>2026-04-13 19:44:44 -0500
commitfe1ccc69661603d419a642a450e4ac9e1258adb0 (patch)
tree386455b6b5468abdd9dfa46dd4802b10da8b77a2 /HutchTests/ProjectTests.swift
parent6ec9754ce34f331641b000eddef3d44bca2631a5 (diff)
downloadhutch-fe1ccc69661603d419a642a450e4ac9e1258adb0.tar.gz
hutch-fe1ccc69661603d419a642a450e4ac9e1258adb0.tar.bz2
hutch-fe1ccc69661603d419a642a450e4ac9e1258adb0.zip
fix: centralize URLs, tighten models, and polish SwiftUI bindingsv3.1.3
- 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.
Diffstat (limited to 'HutchTests/ProjectTests.swift')
-rw-r--r--HutchTests/ProjectTests.swift135
1 files changed, 72 insertions, 63 deletions
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")