package web import ( "testing" "bookmarkmanager/backend/internal/store" ) // seriesDetailView derives the provenance line from the three stamps the // admin projection already carries: the correction stamp outranks a raising // Reader, which outranks a check stamp, and a Series with none of the three // renders no line at all — it was never read, and no actor class is true of // it. Acquisition stamps latest_checked_at exactly as a Poll does, so an // acquired value lands in the same "machine read" class (#152). func TestSeriesDetailViewProvenance(t *testing.T) { cases := []struct { name string a store.AdminSeries want string }{ {"correction stamp", store.AdminSeries{LatestCorrectedAt: 1}, "correction"}, {"raising reader only", store.AdminSeries{RaisedByReader: true}, "sighting"}, {"check stamp only", store.AdminSeries{LatestCheckedAt: 1}, "machine read"}, {"correction outranks sighting", store.AdminSeries{LatestCorrectedAt: 1, RaisedByReader: true}, "correction"}, {"none of the three", store.AdminSeries{}, ""}, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { if got := (&Handler{}).seriesDetailView(tc.a).Provenance; got != tc.want { t.Fatalf("Provenance = %q, want %q", got, tc.want) } }) } }