Files
aego/engine/docs/try_artifacts_test.go
sanspie 5eb1832907
ci-platforms / darwin amd64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 15m28s
ci / release (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 7m47s
Complete Stage 12 for v0.12.0
2026-11-05 11:46:53 +03:00

36 lines
1.0 KiB
Go

//go:build !aego_runtime
package docs
import (
"strings"
"testing"
"testing/fstest"
"aego/engine/module"
)
func TestTryArtifactsRejectInvalidOrMissingPreparedData(t *testing.T) {
for _, missing := range []bool{false, true} {
t.Run(map[bool]string{false: "malformed", true: "missing"}[missing], func(t *testing.T) {
files := fstest.MapFS{"page.md": page("---\nid: demo\ntry: try/Example.aescene\n---\n# Demo\n"), "try/Example.aescene": page("scene version=1 {}")}
if missing {
files["try/Example.assets/project.aego"] = page("project version=1 {}")
} else {
files["try/Example.aetry"] = page("broken")
}
r := Assemble(Sources{Docs: []module.DocSource{{Owner: "game", FS: files}}})
found := false
for _, p := range r.Check(false) {
found = found || p.Error && strings.Contains(p.Message, ".aetry")
}
if !found {
t.Fatal("invalid Try artifacts did not block docs check")
}
if e, ok := r.Get("demo"); !ok || len(e.TryArtifacts) != 0 {
t.Fatal("bad payload published")
}
})
}
}