From 5f6d545eb3455a9e4da5a3cb4460811e3a48d939 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 00:34:54 -0500 Subject: improve home attention flows and cross-linking --- HutchTests/InboxViewModelTests.swift | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'HutchTests/InboxViewModelTests.swift') diff --git a/HutchTests/InboxViewModelTests.swift b/HutchTests/InboxViewModelTests.swift index 597bbc2..a5a0428 100644 --- a/HutchTests/InboxViewModelTests.swift +++ b/HutchTests/InboxViewModelTests.swift @@ -165,6 +165,55 @@ struct InboxViewModelTests { #expect(senderMatches.map(\.rootEmailID) == [11]) } + @Test + func inboxFilterSeparatesPatchThreadsFromDiscussionThreads() { + let baseList = InboxMailingListReference( + id: 1, + rid: "list", + name: "hutch-devel", + owner: Entity(canonicalName: "~owner") + ) + let patchThread = InboxThreadSummary( + rootEmailID: 10, + rootMessageID: "message-1", + threadRootEmailIDs: [10], + threadRootMessageIDs: ["message-1"], + listID: baseList.id, + listRID: baseList.rid, + listName: baseList.name, + listOwner: baseList.owner, + subject: "[PATCH] add search", + latestSender: Entity(canonicalName: "~alice"), + lastActivityAt: Date(timeIntervalSince1970: 100), + messageCount: 1, + repo: "hutch", + containsPatch: true, + isUnread: true + ) + let discussionThread = 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 threads = [patchThread, discussionThread] + + #expect(InboxViewModel.filterThreads(threads, filter: .patches).map(\.rootEmailID) == [10]) + #expect(InboxViewModel.filterThreads(threads, filter: .discussions).map(\.rootEmailID) == [11]) + } + @Test func segmentsPatchBodyAndTreatsSignatureAsPlainText() { let body = """ -- cgit v1.2.3