Files
alan a48e4a5b6a Replace starters with four graded examples seeded into new databases
The template catalog is now Example 1-4: one stage, two stages (handoff),
feedback loop (runner-owned limits, retries, timeout) and human decision
(type=human approve/revise/abort with notify hooks). All read-only or leave
changes uncommitted; none commits, pushes or deploys.

A brand-new database (schema created by this Open) gets the examples once at
server start, bound to the configured default model and harness. A
server_settings marker records the decision, so removed examples never come
back and existing installs are marked without any pipeline being added or
rewritten.
2026-11-03 19:35:47 +00:00

48 lines
1.2 KiB
Go

package tui
import (
"os"
"path/filepath"
"strings"
"testing"
"git.a-wan.net/alan/pipelines/internal/pipeline"
"github.com/charmbracelet/lipgloss"
)
func TestShowcaseGraphsRender(t *testing.T) {
for _, name := range []string{"one-stage", "two-stages", "feedback-loop", "human-decision"} {
t.Run(name, func(t *testing.T) {
source, err := os.ReadFile(filepath.Join("..", "..", "examples", name+".md"))
if err != nil {
t.Fatal(err)
}
graph, err := pipeline.Parse(string(source))
if err != nil {
t.Fatal(err)
}
layout := layoutGraph(graph)
for _, selected := range graph.Stages {
rows := renderGraph(graph, selected.Key)
if len(rows) != layout.height {
t.Fatal("render height differs from layout")
}
for _, row := range rows {
if lipgloss.Width(row) > layout.width {
t.Fatal("render exceeds graph width")
}
}
view := strings.Join(rows, "\n")
for _, stage := range graph.Stages {
if !strings.Contains(view, stage.Key) {
t.Fatalf("missing stage %s", stage.Key)
}
}
if !strings.Contains(view, "SUCCESS") || !strings.Contains(view, "FAILURE") {
t.Fatal("missing terminal nodes")
}
}
})
}
}