From 1f8b7a23529462c3c332753d33810b5c9f692bbc Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 22 Mar 2026 20:42:45 -0500 Subject: feat: add search to builds, trackers, tickets, pastes, mailing lists, and inbox --- HutchTests/InboxViewModelTests.swift | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'HutchTests/InboxViewModelTests.swift') diff --git a/HutchTests/InboxViewModelTests.swift b/HutchTests/InboxViewModelTests.swift index b202d03..597bbc2 100644 --- a/HutchTests/InboxViewModelTests.swift +++ b/HutchTests/InboxViewModelTests.swift @@ -113,6 +113,58 @@ struct InboxViewModelTests { #expect(first.id != second.id) } + @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 = """ -- cgit v1.2.3