rastrillo / fiesta Public

Hold Getting started's scripts paragraph to every script the release ships

The paragraph on the optional scripts is where a reader learns each
script exists and may be deleted, and nothing held it to the release:
copy.js shipped with the paragraph silent about it, and only a reader
noticed. The new test reads the scripts off build.Dist rather than a
list written beside it, so the next script fails until the English
names it. It holds the English, which the eleven translations are
drafted from.

Red by mutation: with copy.js taken out of the English paragraph, the
test fails naming copy.js. Reverted; it passes on the paragraph as it
stands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 206bc437a34283bfeb75a0cf0518c807458fdbd1 parent dfd1f04
1 file changed, +29 −0
  • internal/gallery/started_test.go +29 −0
diff --git a/internal/gallery/started_test.go b/internal/gallery/started_test.go
index d851330..2ce49a8 100644
--- a/internal/gallery/started_test.go
+++ b/internal/gallery/started_test.go
@@ -504,3 +504,32 @@ func TestEveryShippedFileWeighsLessCompressed(t *testing.T) {
}
}
}
+
+// TestTheScriptsParagraphNamesEveryShippedScript: Getting started's
+// paragraph on the optional scripts names every script the release
+// ships. It is the one place a reader learns a script exists and may be
+// deleted, so a script left out of it is one nobody loads: copy.js
+// shipped once with the paragraph silent about it. The list is read
+// off the release build, not written here, so a new script fails this
+// until the English names it. The English is the source of the eleven
+// translations, so it is the one held here.
+func TestTheScriptsParagraphNamesEveryShippedScript(t *testing.T) {
+ body := say("gallery.started.scripts.body")
+ scripts := 0
+ for name := range releaseBuild(t) {
+ if strings.Contains(name, "/") || !strings.HasSuffix(name, ".js") {
+ continue
+ }
+ scripts++
+ // Bounded on both sides, so fiesta.js is not found inside a
+ // longer name such as notfiesta.js.
+ named := regexp.MustCompile(`(^|[^\w.-])` + regexp.QuoteMeta(name) + `($|[^\w-])`)
+ if !named.MatchString(body) {
+ t.Errorf("the release ships %s, but Getting started's scripts paragraph does not name it:\n %s", name, body)
+ }
+ }
+ // A build that ships no scripts passes whatever the paragraph says.
+ if scripts < len(fiesta.ScriptNames()) {
+ t.Fatalf("the release build ships %d top-level scripts, want at least %d; this is reading the wrong files", scripts, len(fiesta.ScriptNames()))
+ }
+}