summaryrefslogtreecommitdiff
path: root/HutchTests/InboxViewModelTests.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-03-22 20:42:45 -0500
committerChristian Cleberg <[email protected]>2026-03-22 20:42:45 -0500
commit1f8b7a23529462c3c332753d33810b5c9f692bbc (patch)
tree17526dae77a7579b270e6b9cca6224c9020f772d /HutchTests/InboxViewModelTests.swift
parente03791d6c15ee0caac033d1b1b390c5d65a69d57 (diff)
downloadhutch-1f8b7a23529462c3c332753d33810b5c9f692bbc.tar.gz
hutch-1f8b7a23529462c3c332753d33810b5c9f692bbc.tar.bz2
hutch-1f8b7a23529462c3c332753d33810b5c9f692bbc.zip
feat: add search to builds, trackers, tickets, pastes, mailing lists, and inbox
Diffstat (limited to 'HutchTests/InboxViewModelTests.swift')
-rw-r--r--HutchTests/InboxViewModelTests.swift52
1 files changed, 52 insertions, 0 deletions
diff --git a/HutchTests/InboxViewModelTests.swift b/HutchTests/InboxViewModelTests.swift
index b202d03..597bbc2 100644
--- a/HutchTests/InboxViewModelTests.swift
+++ b/HutchTests/InboxViewModelTests.swift
@@ -114,6 +114,58 @@ struct InboxViewModelTests {
}
@Test
+ func mailingListThreadFilterMatchesSubjectAndSender() {
+ let baseList = InboxMailingListReference(
+ id: 1,
+ rid: "list",
+ name: "hutch-devel",
+ owner: Entity(canonicalName: "~owner")
+ )
+ let threads = [
+ InboxThreadSummary(
+ rootEmailID: 10,
+ rootMessageID: "message-1",
+ threadRootEmailIDs: [10],
+ threadRootMessageIDs: ["message-1"],
+ listID: baseList.id,
+ listRID: baseList.rid,
+ listName: baseList.name,
+ listOwner: baseList.owner,
+ subject: "Re: [PATCH] add search",
+ latestSender: Entity(canonicalName: "~alice"),
+ lastActivityAt: Date(timeIntervalSince1970: 100),
+ messageCount: 1,
+ repo: "hutch",
+ containsPatch: true,
+ isUnread: true
+ ),
+ InboxThreadSummary(
+ rootEmailID: 11,
+ rootMessageID: "message-2",
+ threadRootEmailIDs: [11],
+ threadRootMessageIDs: ["message-2"],
+ listID: baseList.id,
+ listRID: baseList.rid,
+ listName: baseList.name,
+ listOwner: baseList.owner,
+ subject: "Release planning",
+ latestSender: Entity(canonicalName: "~bob"),
+ lastActivityAt: Date(timeIntervalSince1970: 200),
+ messageCount: 2,
+ repo: "hutch",
+ containsPatch: false,
+ isUnread: true
+ )
+ ]
+
+ let subjectMatches = MailingListDetailViewModel.filterThreads(threads, matching: "search")
+ let senderMatches = MailingListDetailViewModel.filterThreads(threads, matching: "~bob")
+
+ #expect(subjectMatches.map(\.rootEmailID) == [10])
+ #expect(senderMatches.map(\.rootEmailID) == [11])
+ }
+
+ @Test
func segmentsPatchBodyAndTreatsSignatureAsPlainText() {
let body = """
From: Christian Cleberg <[email protected]>