diff options
| author | Christian Cleberg <[email protected]> | 2026-08-07 03:16:14 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-08-07 03:16:14 -0500 |
| commit | 6c26cf048119bf4ff6af039991d3e34d76bac2ad (patch) | |
| tree | 22c3280dca5f85923ddc3cc85bff8751ad46b7fe /HutchTests | |
| parent | 044c33f7f43db1f38d6c44dd8f483298d9efcc06 (diff) | |
| parent | 9c11d69002d71556fea1e2a938e02d4f4d503ea5 (diff) | |
| download | hutch-6c26cf048119bf4ff6af039991d3e34d76bac2ad.tar.gz hutch-6c26cf048119bf4ff6af039991d3e34d76bac2ad.tar.bz2 hutch-6c26cf048119bf4ff6af039991d3e34d76bac2ad.zip | |
Merge pull request #31 from krazywarez/app-intents-expansion
Expand App Intents: dialogs, search type, mutating intents (#17)
Diffstat (limited to 'HutchTests')
| -rw-r--r-- | HutchTests/DeepLinkTests.swift | 3 | ||||
| -rw-r--r-- | HutchTests/HutchIntentsTests.swift | 33 |
2 files changed, 35 insertions, 1 deletions
diff --git a/HutchTests/DeepLinkTests.swift b/HutchTests/DeepLinkTests.swift index d62cfef..cdc5bab 100644 --- a/HutchTests/DeepLinkTests.swift +++ b/HutchTests/DeepLinkTests.swift @@ -92,7 +92,8 @@ struct DeepLinkTests { 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.search(query: "patch queue", type: nil).url) == .search(query: "patch queue", type: nil)) + #expect(DeepLink(url: HutchRoute.search(query: "~alice", type: .user).url) == .search(query: "~alice", type: .user)) #expect(DeepLink(url: HutchRoute.projectDashboard(id: "project-1", title: "Hutch").url) == .projectDashboard(id: "project-1", title: "Hutch")) } diff --git a/HutchTests/HutchIntentsTests.swift b/HutchTests/HutchIntentsTests.swift index ddbe973..e201f42 100644 --- a/HutchTests/HutchIntentsTests.swift +++ b/HutchTests/HutchIntentsTests.swift @@ -110,4 +110,37 @@ struct HutchIntentsTests { ActiveAccountContextStore.save("account-a", defaults: defaults) #expect(NeedsAttentionSnapshotStore.load(defaults: defaults)?.failedBuilds == 3) } + + @Test + func searchIntentCarriesQueryAndType() { + let intent = SearchHutchIntent() + intent.query = "~alice/hutch" + intent.searchType = .tracker + #expect(intent.route == .search(query: "~alice/hutch", type: .tracker)) + } + + @Test + func searchIntentWithBlankQueryFallsBackToLookup() { + let intent = SearchHutchIntent() + intent.query = " " + intent.searchType = .user + #expect(intent.route == .lookup) + } + + @Test + func removePinDropsMatchingResource() { + let defaultsName = "HutchIntentsTests-unpin-\(UUID().uuidString)" + let defaults = UserDefaults(suiteName: defaultsName)! + defer { defaults.removePersistentDomain(forName: defaultsName) } + + let alice = HomePinRecord(kind: .user, value: "~alice", title: "~alice", subtitle: "User", ownerUsername: "~alice", service: nil) + let bob = HomePinRecord(kind: .user, value: "~bob", title: "~bob", subtitle: "User", ownerUsername: "~bob", service: nil) + HomePinStore.togglePin(alice, for: "~me", defaults: defaults) + HomePinStore.togglePin(bob, for: "~me", defaults: defaults) + + HomePinStore.removePin(id: alice.id, for: "~me", defaults: defaults) + + let remaining = HomePinStore.loadPins(for: "~me", defaults: defaults) + #expect(remaining.map(\.id) == [bob.id]) + } } |
