test(api-discovery-test): add 3 assertions for tier=engine

Covers the new engine-tier validate_readme_structure behavior:
complete engine README, missing-API detection, and the relaxed Badges
pattern that accepts arbitrary bold key:value lines (engine has no
Lib-ID prefix).

Total assertion-count grows from 52 to 55. Coverage table updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Axel Meyer
2026-05-16 18:45:07 +02:00
parent c3c8b7579b
commit 8131f42ba0
2 changed files with 50 additions and 2 deletions

View File

@@ -321,6 +321,54 @@ Sig.
-- Tier community: lockerer
local r3 = api.validate_readme_structure(missing_api, "community")
engine.test.equals(#r3.missing_sections, 0, "validate: tier=community -> no enforcement")
-- Tier engine: same structure as core but flexible Badges
local engine_md = [[
# sporel-engine
**Version:** 0.1.0
**License:** Proprietary
## Topology
<!-- topology:start -->
<!-- topology:end -->
## API
text
## References
- spec
]]
local r_engine = api.validate_readme_structure(engine_md, "engine")
engine.test.equals(#r_engine.missing_sections, 0, "validate: engine README -> no missing")
-- Missing API in engine README -> still detected
local engine_no_api = [[
# sporel-engine
**Version:** 0.1.0
## Topology
<!-- topology:start -->
<!-- topology:end -->
## References
]]
local r_engine_no_api = api.validate_readme_structure(engine_no_api, "engine")
engine.test.assert(#r_engine_no_api.missing_sections > 0, "validate: engine without API -> reports missing")
-- Naked Badges line (no Lib-ID prefix) accepted in engine tier
local engine_naked = [[
# sporel-engine
**Anything:** value
]]
local r_engine_naked = api.validate_readme_structure(engine_naked, "engine")
-- Just verify Badges-check doesn't fail because of missing "Lib-ID:" prefix
local badges_missing = false
for _, s in ipairs(r_engine_naked.missing_sections) do
if s == "Badges" then badges_missing = true end
end
engine.test.assert(not badges_missing, "validate: engine tier accepts naked badges")
end
engine.exit(engine.test.failures())