test: share the first-page and clock helpers

writeFirstPage answers paged listings in app and services tests,
testNow replaces the copied clock, withoutANSI the second color
stripper, and the single-entry table test becomes a plain test.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 14:25:38 +02:00
1 parent 83924892ff
commit dc24231ebc
23 files changed
+66 -105

No files matched your search

+1 -5
View File
@@ -34,11 +34,7 @@ func TestWikiEditRenamesAndKeepsTheContent(t *testing.T) {
func TestWikiListLimitsPagesOnTheClient(t *testing.T) {
server := newAuthenticatedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("page") != "1" {
_, _ = w.Write([]byte(`[]`))
return
}
_, _ = w.Write([]byte(`[{"title":"Getting Started","last_commit":{"author":{"name":"alice","date":"2026-10-11T18:00:00Z"}}},{"title":"Home"}]`))
writeFirstPage(w, r, `[{"title":"Getting Started","last_commit":{"author":{"name":"alice","date":"2026-10-11T18:00:00Z"}}},{"title":"Home"}]`)
}))
defer server.Close()
deps, out, _ := repoTTYDeps(t, server.URL)