summaryrefslogtreecommitdiff
path: root/HutchTests/HutchIntentsTests.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-12 23:19:20 -0500
committerChristian Cleberg <[email protected]>2026-04-12 23:19:20 -0500
commitee9f2904aa319231b7047fca3cb069f0c07019cd (patch)
tree69a18234512c63f38f0d477e0023969698ec3c9e /HutchTests/HutchIntentsTests.swift
parent72f860e0e171f6aac4e7d896e7a571147dbcb5c5 (diff)
downloadhutch-ee9f2904aa319231b7047fca3cb069f0c07019cd.tar.gz
hutch-ee9f2904aa319231b7047fca3cb069f0c07019cd.tar.bz2
hutch-ee9f2904aa319231b7047fca3cb069f0c07019cd.zip
feat: add multi-account support
Implements: https://todo.sr.ht/~ccleberg/hutch/49 Implements: https://todo.sr.ht/~ccleberg/hutch/50 Implements: https://todo.sr.ht/~ccleberg/hutch/51
Diffstat (limited to 'HutchTests/HutchIntentsTests.swift')
-rw-r--r--HutchTests/HutchIntentsTests.swift29
1 files changed, 29 insertions, 0 deletions
diff --git a/HutchTests/HutchIntentsTests.swift b/HutchTests/HutchIntentsTests.swift
index 94ecbf0..3cb7ad6 100644
--- a/HutchTests/HutchIntentsTests.swift
+++ b/HutchTests/HutchIntentsTests.swift
@@ -72,4 +72,33 @@ struct HutchIntentsTests {
#expect(loaded?.unreadInboxThreads == 5)
#expect(loaded?.assignedOpenTickets == 3)
}
+
+ @Test
+ func needsAttentionSnapshotsAreIsolatedPerAccount() {
+ let defaultsName = "HutchIntentsTests-builds-isolation-\(UUID().uuidString)"
+ let defaults = UserDefaults(suiteName: defaultsName)!
+ defer { defaults.removePersistentDomain(forName: defaultsName) }
+
+ let firstSnapshot = NeedsAttentionSnapshot(
+ unreadInboxThreads: 1,
+ assignedOpenTickets: 2,
+ failedBuilds: 3,
+ updatedAt: Date(timeIntervalSince1970: 100)
+ )
+ let secondSnapshot = NeedsAttentionSnapshot(
+ unreadInboxThreads: 8,
+ assignedOpenTickets: 5,
+ failedBuilds: 1,
+ updatedAt: Date(timeIntervalSince1970: 200)
+ )
+
+ NeedsAttentionSnapshotStore.save(firstSnapshot, accountID: "account-a", defaults: defaults)
+ NeedsAttentionSnapshotStore.save(secondSnapshot, accountID: "account-b", defaults: defaults)
+
+ #expect(NeedsAttentionSnapshotStore.load(accountID: "account-a", defaults: defaults)?.unreadInboxThreads == 1)
+ #expect(NeedsAttentionSnapshotStore.load(accountID: "account-b", defaults: defaults)?.unreadInboxThreads == 8)
+
+ ActiveAccountContextStore.save("account-a", defaults: defaults)
+ #expect(NeedsAttentionSnapshotStore.load(defaults: defaults)?.failedBuilds == 3)
+ }
}