Skip to content
quarry Artifact [b5fa38b421]
Login

Artifact [b5fa38b421]

Artifact b5fa38b4212b219b7c3417fd921397c03337f6adb03e81c1db900008f76ab4c6:


package api

import (
	"os"
	"testing"

	"craftdesign.group/quarry/internal/ops"
)

// TestDocsCurrent is the documentation exit criterion (0003): docs/api.md
// must match what the registry generates. Regenerate with `make docs`.
func TestDocsCurrent(t *testing.T) {
	r := ops.NewRegistry()
	// A non-nil Chat plane, same as cmd/quarry's docs/spec generation
	// uses (docsChatPlane there): RegisterAll gates chat.* on Deps.Chat
	// != nil, and this reference registry has to match what actually
	// gets documented or every chat op reads as permanently stale.
	if err := RegisterAll(r, Deps{Version: "v", Chat: &fakeChat{}}); err != nil {
		t.Fatal(err)
	}
	want := ops.Docs(r, "quarry")
	got, err := os.ReadFile("../../docs/api.md")
	if err != nil {
		t.Fatalf("docs/api.md unreadable (run `make docs`): %v", err)
	}
	if string(got) != string(want) {
		t.Fatal("docs/api.md is stale — run `make docs` and commit the result")
	}
}