#142: fix stale filter count cutoff, tighten comments (review fixes)
This commit is contained in:
+9
-3
@@ -1939,15 +1939,16 @@ func TestSeriesListFilterWiring(t *testing.T) {
|
||||
t.Fatalf("open %s: %v", dsn, err)
|
||||
}
|
||||
defer db.Close()
|
||||
seedSeriesRow(t, st, db, seriesRowSeed{key: "asura:healthy", url: "https://asurascans.com/comics/healthy", cover: "aaa", checkedAt: 9000, latestNum: floatPtr(10), bookmarks: 1})
|
||||
seedSeriesRow(t, st, db, seriesRowSeed{key: "asura:nocover", url: "https://asurascans.com/comics/nocover", checkedAt: 9000, latestNum: floatPtr(3), bookmarks: 1})
|
||||
seedSeriesRow(t, st, db, seriesRowSeed{key: "asura:healthy", url: "https://asurascans.com/comics/healthy", cover: "aaa", checkedAt: time.Now().UnixMilli(), latestNum: floatPtr(10), bookmarks: 1})
|
||||
seedSeriesRow(t, st, db, seriesRowSeed{key: "asura:nocover", url: "https://asurascans.com/comics/nocover", checkedAt: time.Now().UnixMilli(), latestNum: floatPtr(3), bookmarks: 1})
|
||||
seedSeriesRow(t, st, db, seriesRowSeed{key: "asura:stale", url: "https://asurascans.com/comics/stale", cover: "bbb", checkedAt: time.Now().Add(-24 * time.Hour).UnixMilli(), latestNum: floatPtr(4), bookmarks: 1})
|
||||
srv := newRouter(st, testConfig(), nil)
|
||||
|
||||
body := adminSeriesPage(t, srv, st, "?filter=no_cover")
|
||||
if !strings.Contains(body, "Title of asura:nocover") {
|
||||
t.Errorf("no_cover list misses its row:\n%s", body)
|
||||
}
|
||||
if strings.Contains(body, "Title of asura:healthy") {
|
||||
if strings.Contains(body, "Title of asura:healthy") || strings.Contains(body, "Title of asura:stale") {
|
||||
t.Errorf("no_cover list renders a covered row:\n%s", body)
|
||||
}
|
||||
if !strings.Contains(body, "1 series") || !strings.Contains(body, "No cover") {
|
||||
@@ -1959,6 +1960,11 @@ func TestSeriesListFilterWiring(t *testing.T) {
|
||||
if !strings.Contains(body, `<option value="no_cover" selected>`) {
|
||||
t.Errorf("the no_cover option is not selected:\n%s", body)
|
||||
}
|
||||
// The stale option's count is cutoff-dependent: the row read passes the
|
||||
// 12h boundary, and so must the aggregate that numbers the select.
|
||||
if !strings.Contains(body, "Not checked in 12h (1)") {
|
||||
t.Errorf("the stale option lacks its cutoff-dependent count:\n%s", body)
|
||||
}
|
||||
|
||||
// An unknown filter value is the absent All case: both rows, no error.
|
||||
body = adminSeriesPage(t, srv, st, "?filter=bogus")
|
||||
|
||||
Reference in New Issue
Block a user