Skip to content
quarry Artifact [92cf762ca4]
Login

Artifact [92cf762ca4]

Artifact 92cf762ca4d74b2cdcd601e1f159fdfbac589118629b05a4114fc6029a6edbc1:


package index

import (
	"strings"
	"testing"
)

// TWO CHANGES TO ONE TICKET READ DIFFERENTLY.
//
// Every ticket row on the timeline carries the ticket's title, so the
// Atom feed showed two changes to one ticket as two identical entries
// (jva, sandbox #1160: 11 of 50 ticket entries repeated). Each row now
// says what its change did.
func TestEachTicketChangeSaysWhatItDid(t *testing.T) {
	ix := openIndex(t)
	id := strings.Repeat("ab", 20)
	foldTicket(t, ix, "tc1", id, "2026-01-01T10:00:00",
		"title", "the flaky test", "status", "Open", "type", "Code_Defect")
	foldTicket(t, ix, "tc2", id, "2026-01-02T10:00:00",
		"icomment", "Seen again on trunk.\nSecond line is not in the summary.", "mimetype", "text/x-markdown")
	foldTicket(t, ix, "tc3", id, "2026-01-03T10:00:00",
		"status", "Closed", "resolution", "Fixed", "icomment", "Fixed by the retry.")
	tl, _, err := ix.Timeline(TimelineFilter{Limit: 50})
	if err != nil {
		t.Fatal(err)
	}
	got := map[string]string{}
	for _, e := range tl {
		if e.Kind == "t" {
			got[e.Hash] = e.Change
		}
	}
	for hash, want := range map[string]string{
		"tc1": "opened",
		"tc2": "comment: Seen again on trunk.",
		"tc3": "status Closed, resolution Fixed; comment: Fixed by the retry.",
	} {
		if got[hash] != want {
			t.Errorf("FAIL: change %s reads %q, want %q", hash, got[hash], want)
		}
	}
}