Skip to content
quarry Artifact [0765a24510]
Login

Artifact [0765a24510]

Artifact 0765a24510c9627deae283c12efa02f2196ff89016fc23fae944af2e69722060:


package web

import (
	"os"
	"path/filepath"
	"strings"
	"testing"
)

// TestWriteLandingShot is a LOOKING aid, not a guard: it writes the
// landing record as a full page so the facts rows can be seen at phone
// width. Off unless QUARRY_SHOT names a file.
func TestWriteLandingShot(t *testing.T) {
	out := os.Getenv("QUARRY_SHOT")
	if out == "" {
		t.Skip("QUARRY_SHOT unset")
	}
	d := pageData{
		Title: "Landing", Repo: "quarry", Section: "landings",
		Landing: &landingDetail{landingRow: landingRow{
			ID:      "b1c49d85f52bb15e011069c56050adbafd526eb5424555d56169422269971597",
			Branch:  "lane-visibility",
			Target:  "trunk",
			State:   "accepted",
			Author:  "zeitgeist",
			Opened:  "2026-09-12T16:03:00",
			Updated: "2026-09-12T16:31:00",
			Title:   "ops: the lanes panel lists every lane, with its queue depth. closes a488d7fa42 and addresses 8d5aa739f8",
		}},
	}
	d.Landing.Merge.Checkin = "78032a7b0a0b1122334455667788990011223344"
	d.Landing.Merge.Date = "2026-09-12T16:31:00"
	d.Landing.Merge.User = "dmestas"
	// The stylesheet inline, so the file renders standalone: the real
	// page links a content-hashed asset this has no server to serve.
	d.SheetURL = "quarry.css"
	var buf strings.Builder
	if err := noHooks.template(landingPage).Execute(&buf, d); err != nil {
		t.Fatal(err)
	}
	if err := os.WriteFile(out, []byte(buf.String()), 0o644); err != nil {
		t.Fatal(err)
	}
	if err := os.WriteFile(filepath.Join(filepath.Dir(out), "quarry.css"), []byte(sheet), 0o644); err != nil {
		t.Fatal(err)
	}
	t.Logf("ok: wrote %s (%d bytes)", out, buf.Len())
}