about summary refs log tree commit homepage
path: root/t/psgi_v2.t
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-26 19:33:18 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-27 10:18:45 +0000
commit956abe9ad5f13a0d1755262be412d6a54fda72e9 (patch)
treecda2a73b8e234dbf6e3b1842e541054ab8a4d777 /t/psgi_v2.t
parent50f7b8e95db516104cef237bb0a555a566ff150e (diff)
downloadpublic-inbox-956abe9ad5f13a0d1755262be412d6a54fda72e9.tar.gz
Since we need to handle messages with multiple and duplicate
Message-ID headers, our thread skeleton display must account
for that.

Since we have a "preferred" Message-ID in case of conflicts,
use it as the UUID in an Atom feed so readers do not get
confused by conflicts.
Diffstat (limited to 't/psgi_v2.t')
-rw-r--r--t/psgi_v2.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index eaa3218c..2a798d6f 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -139,6 +139,32 @@ test_psgi(sub { $www->call(@_) }, sub {
         foreach my $mid ('a-mid@b', $new_mid, $third) {
                 like($raw, qr/&lt;\Q$mid\E&gt;/s, "Message-ID $mid shown");
         }
+        like($raw, qr/\b3\+ messages\b/, 'thread overview shown');
+
+        my $exp = [ qw(<a-mid@b> <reuse@mid>) ];
+        $mime->header_set('Message-Id', @$exp);
+        $mime->header_set('Subject', '4th dupe');
+        local $SIG{__WARN__} = sub {};
+        ok($im->add($mime), 'added one message');
+        $im->done;
+        my @h = $mime->header('Message-ID');
+        is_deeply($exp, \@h, 'reused existing Message-ID');
+
+        $config->each_inbox(sub { $_[0]->search->reopen });
+
+        $res = $cb->(GET('/v2test/new.atom'));
+        my @ids = ($res->content =~ m!<id>urn:uuid:([^<]+)</id>!sg);
+        my %ids;
+        $ids{$_}++ for @ids;
+        is_deeply([qw(1 1 1 1)], [values %ids], 'feed ids unique');
+
+        $res = $cb->(GET('/v2test/reuse@mid/T/'));
+        $raw = $res->content;
+        like($raw, qr/\b4\+ messages\b/, 'thread overview shown with /T/');
+
+        $res = $cb->(GET('/v2test/reuse@mid/t/'));
+        $raw = $res->content;
+        like($raw, qr/\b4\+ messages\b/, 'thread overview shown with /t/');
 });
 
 done_testing();