summaryrefslogtreecommitdiff
path: root/HutchTests
diff options
context:
space:
mode:
Diffstat (limited to 'HutchTests')
-rw-r--r--HutchTests/BuildListViewModelTests.swift6
-rw-r--r--HutchTests/DeepLinkTests.swift8
-rw-r--r--HutchTests/HutchIntentsTests.swift9
3 files changed, 23 insertions, 0 deletions
diff --git a/HutchTests/BuildListViewModelTests.swift b/HutchTests/BuildListViewModelTests.swift
index aa2e46b..8ee5b81 100644
--- a/HutchTests/BuildListViewModelTests.swift
+++ b/HutchTests/BuildListViewModelTests.swift
@@ -59,9 +59,15 @@ struct BuildListViewModelTests {
filter: .active,
lookbackDays: BuildListViewModel.defaultLookbackDays
)
+ let failed = BuildListViewModel.filterJobs(
+ jobs,
+ filter: .failed,
+ lookbackDays: BuildListViewModel.defaultLookbackDays
+ )
#expect(attention.map(\.id) == [2, 3])
#expect(active.map(\.id) == [3])
+ #expect(failed.map(\.id) == [2])
}
@Test
diff --git a/HutchTests/DeepLinkTests.swift b/HutchTests/DeepLinkTests.swift
index 500c4cd..d62cfef 100644
--- a/HutchTests/DeepLinkTests.swift
+++ b/HutchTests/DeepLinkTests.swift
@@ -89,6 +89,14 @@ struct DeepLinkTests {
}
@Test
+ func parsesRouteBackedNavigationLinks() {
+ #expect(DeepLink(url: HutchRoute.workQueue(scope: .assigned).url) == .workQueue(scope: .assigned))
+ #expect(DeepLink(url: HutchRoute.failedBuilds.url) == .failedBuilds)
+ #expect(DeepLink(url: HutchRoute.search(query: "patch queue").url) == .search(query: "patch queue"))
+ #expect(DeepLink(url: HutchRoute.projectDashboard(id: "project-1", title: "Hutch").url) == .projectDashboard(id: "project-1", title: "Hutch"))
+ }
+
+ @Test
func parsesUserProfileLink() {
let link = DeepLink(url: HutchDeepLinkURL.userProfile)
#expect(link == .userProfile(owner: "~owner"))
diff --git a/HutchTests/HutchIntentsTests.swift b/HutchTests/HutchIntentsTests.swift
index 3cb7ad6..ddbe973 100644
--- a/HutchTests/HutchIntentsTests.swift
+++ b/HutchTests/HutchIntentsTests.swift
@@ -6,6 +6,15 @@ import Testing
struct HutchIntentsTests {
@Test
+ func navigationIntentsMapToCentralRoutes() {
+ #expect(OpenWorkQueueIntent().route == .workQueue(scope: .all))
+ #expect(OpenRecentActivityIntent().route == .recentActivity)
+ #expect(OpenSystemStatusIntent().route == .systemStatus)
+ #expect(OpenFailedBuildsIntent().route == .failedBuilds)
+ #expect(OpenAssignedTicketsIntent().route == .workQueue(scope: .assigned))
+ }
+
+ @Test
func checkSystemStatusReturnsOperationalWhenNoDisruption() async throws {
let defaultsName = "HutchIntentsTests-status-\(UUID().uuidString)"
let defaults = UserDefaults(suiteName: defaultsName)!