package web
import (
"os"
"path/filepath"
"strings"
"testing"
"craftdesign.group/quarry/internal/api"
)
// A LOOKING aid for the REPOSITORY board after the card became a shared
// component. The refactor is meant to change nothing here, and "the
// tests pass" does not prove that about a layout. Off unless
// QUARRY_SHOT_REPOBOARD is set.
func TestWriteRepoBoardShot(t *testing.T) {
out := os.Getenv("QUARRY_SHOT_REPOBOARD")
if out == "" {
t.Skip("QUARRY_SHOT_REPOBOARD unset")
}
if err := os.WriteFile(filepath.Join(filepath.Dir(out), "quarry.css"),
[]byte(sheet), 0o644); err != nil {
t.Fatal(err)
}
rows := []ticketSummary{
{Repo: "quarry", ID: "8318bd2819ca7f31aa", Title: "Teams: organisations that own repositories and carry grants",
Status: "Open", Priority: "Low", Assignee: "dmestas", Updated: "2026-09-13T20:10:00Z"},
{Repo: "quarry", ID: "085786dd870e4455bb", Title: "The Reader preset grants wiki and ticket editing",
Status: "Open", Priority: "High", Severity: "Important", Updated: "2026-09-13T17:05:00Z"},
{Repo: "quarry", ID: "b906985a303c1122cc", Title: "ci: supersede and label queries are exact only below the scan",
Status: "Fixed", Priority: "Medium", Assignee: "lou", Updated: "2026-09-12T11:00:00Z"},
}
vocab := api.DefaultTicketVocabulary
labels := columnLabels(rows, "status", vocab)
data := pageData{Title: "Tickets", Repo: "quarry", Section: "tickets",
Board: buildBoard(rows, "status", "", vocab, cardView{
LaneBy: "", GroupBy: "status", ColumnLabels: labels}),
GroupBy: "status", ColumnLabels: labels, SheetURL: "quarry.css",
Nav: ticketNav{Repo: "quarry", View: "board", Open: 2, Closed: 1},
}
data.allowCards(true)
var buf strings.Builder
if err := ticketBoardPage.Execute(&buf, data); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(out, []byte(buf.String()), 0o644); err != nil {
t.Fatal(err)
}
t.Logf("ok: wrote %s", out)
}