Skip to content
quarry Artifact [d4906eae85]
Login

Artifact [d4906eae85]

Artifact d4906eae85528aa31bf63da85a49f4bbc2b7aa8f9d9b76111fa60f5ae4dddc80:


package web

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

// The landing panel with a required check whose only run was
// cancelled — the state that read "1 failing check" and offered the
// reader nothing. No fixture existed for it, which is part of why it
// went unnoticed.
func TestWriteCancelledLandingShot(t *testing.T) {
	out := os.Getenv("QUARRY_SHOT_CANCELLED")
	if out == "" {
		t.Skip("QUARRY_SHOT_CANCELLED unset")
	}
	if err := os.WriteFile(filepath.Join(filepath.Dir(out), "quarry.css"),
		[]byte(sheet), 0o644); err != nil {
		t.Fatal(err)
	}
	det := landingDetail{
		landingRow: landingRow{
			ID:     "d153407aa6ea1f2c",
			Title:  "ci: fire a run when a landing opens and its tip has none",
			Branch: "ci-landing-trigger", Target: "trunk",
			State: "open", Author: "dmestas",
			Opened: "2026-09-14T09:12:00Z",
		},
		Mergeable: "clean",
		Required:  []string{"quarry"},
		Unmet:     []string{"quarry"},
		Checks: []ciRunRow{{
			RunID: "9f2c1ab4e7d05531", Workflow: "quarry", Pipeline: "ci/quarry.json",
			Status: "cancelled", Started: "2026-09-14T09:14:00Z"}},
	}
	var buf strings.Builder
	if err := noHooks.template(landingPage).Execute(&buf, pageData{
		Title: det.Title, Repo: "quarry", SheetURL: "quarry.css",
		Landing: &det, CanTrigger: true}); err != nil {
		t.Fatal(err)
	}
	if err := os.WriteFile(out, []byte(buf.String()), 0o644); err != nil {
		t.Fatal(err)
	}
}