summaryrefslogtreecommitdiff
path: root/HutchTests
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-19 15:17:38 -0500
committerChristian Cleberg <[email protected]>2026-03-19 15:17:38 -0500
commit6ba4e967d5dfb5d3c7bb97a0f2662f3180595563 (patch)
tree572bef546fcca19ad37bc1aa7cfb153eb2bf8eb7 /HutchTests
parent1e3c748119c6e9eec27f02146f17ea0302ff648a (diff)
downloadhutch-6ba4e967d5dfb5d3c7bb97a0f2662f3180595563.tar.gz
hutch-6ba4e967d5dfb5d3c7bb97a0f2662f3180595563.tar.bz2
hutch-6ba4e967d5dfb5d3c7bb97a0f2662f3180595563.zip
feat: implement support for projects, lists, and pastes
Diffstat (limited to 'HutchTests')
-rw-r--r--HutchTests/ProjectTests.swift72
1 files changed, 72 insertions, 0 deletions
diff --git a/HutchTests/ProjectTests.swift b/HutchTests/ProjectTests.swift
new file mode 100644
index 0000000..a94d6d2
--- /dev/null
+++ b/HutchTests/ProjectTests.swift
@@ -0,0 +1,72 @@
+import Foundation
+import Testing
+@testable import Hutch
+
+struct ProjectTests {
+ @Test
+ func resourceSummaryIncludesCounts() {
+ let project = Project(
+ id: "project-1",
+ name: "Hutch",
+ description: nil,
+ website: nil,
+ visibility: .public,
+ tags: [],
+ 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")
+ )
+ ]
+ )
+
+ #expect(project.resourceSummary == "2 repos • 1 tracker • 1 list")
+ }
+
+ @Test
+ func resourceSummaryFallsBackToWebsite() {
+ let project = Project(
+ id: "project-1",
+ name: "Docs",
+ description: nil,
+ website: "https://example.com",
+ visibility: .public,
+ tags: [],
+ mailingLists: [],
+ sources: [],
+ trackers: []
+ )
+
+ #expect(project.resourceSummary == "Website linked")
+ }
+}