diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-26 15:27:15 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-26 15:27:15 +0200 |
| commit | 3afbce6e2f7d711ab58985d64c3e236484cc7345 (patch) | |
| tree | 6a510063e362acd7d8d4cd3091277332c5d22a8c /tests/test_notmuchworker.cpp | |
| parent | 804454e43cf08ddf39dbf0a765f047f0ac96f529 (diff) | |
| download | qtmaildir-3afbce6e2f7d711ab58985d64c3e236484cc7345.tar.gz qtmaildir-3afbce6e2f7d711ab58985d64c3e236484cc7345.zip | |
feat: carry the first message's sender address on a thread summary
Diffstat (limited to 'tests/test_notmuchworker.cpp')
| -rw-r--r-- | tests/test_notmuchworker.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_notmuchworker.cpp b/tests/test_notmuchworker.cpp index 3f75898..2d19da5 100644 --- a/tests/test_notmuchworker.cpp +++ b/tests/test_notmuchworker.cpp @@ -65,6 +65,7 @@ private slots: void loadMessageOnAnUnknownIdReturnsNothing(); void aQueryCarriesEachThreadsFirstMessageId(); void aSentQueryCarriesTheMatchedMessageNotTheThreadsFirst(); + void queryCarriesTheFirstMessageSender(); void loadThreadTreeReportsReplyDepth(); void loadThreadTreeCarriesTheFactsARowNeeds(); @@ -515,6 +516,41 @@ void TestNotmuchWorker::aSentQueryCarriesTheMatchedMessageNotTheThreadsFirst() } } +void TestNotmuchWorker::queryCarriesTheFirstMessageSender() +{ + // Item 169. The card has no address to hash: `authors` is notmuch's own + // summarised string and carries display names only, measured on the real + // index as 'Ryanair' and 'The Hacker News tramite LinkedIn', with no `@` + // anywhere. firstMessageSender is the BARE address of the one message the + // root card stands for. + // + // The From header carries a display name on purpose: a wrong + // implementation returning the display name or the authors string fails + // this test. + NotmuchFixture fixture; + QVERIFY(fixture.isValid()); + QVERIFY(fixture.addMessage(QStringLiteral("inbox"), + QStringLiteral("sender-probe@example.org"), + QStringLiteral("Probe subject"), + QStringLiteral("Probe <sender-probe@example.org>"), + QStringLiteral("Mon, 8 Jun 2026 10:00:00 +0000"), + QStringLiteral("body"))); + QVERIFY2(fixture.index(), qPrintable(fixture.error())); + + NotmuchWorker worker(fixture.configPath()); + + QSignalSpy spy(&worker, &NotmuchWorker::threadsReady); + worker.runQuery(QStringLiteral("subject:\"Probe subject\""), 1, + NotmuchWorker::NewestFirst, false); + QVERIFY(spy.count() > 0); + + const auto threads = spy.first().at(0).value<QVector<ThreadSummary>>(); + QCOMPARE(threads.size(), 1); + // The bare address, not the display name and not notmuch's authors string. + QCOMPARE(threads.first().firstMessageSender, + QStringLiteral("sender-probe@example.org")); +} + void TestNotmuchWorker::loadThreadTreeReportsReplyDepth() { // Thread A is a root plus one reply carrying In-Reply-To, which is what |
