feat: add platform resource audit baseline

This commit is contained in:
2026-07-27 01:11:38 +08:00
parent 7609d3234a
commit e730343093
5 changed files with 150 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package platform
import "testing"
func TestExpectedResources(t *testing.T) {
assertContract(t, ExpectedResources(), "gas", "gas_basic", Writable, "list")
assertContract(t, ExpectedResources(), "device", "saf_event", Writable, "list")
assertContract(t, ExpectedResources(), "wallet", "wallet_ledger", ReadOnly, "list")
}
func assertContract(t *testing.T, contracts []ResourceContract, domain, name string, mode ResourceMode, pageKind string) {
t.Helper()
for _, contract := range contracts {
if contract.Domain == domain && contract.Name == name && contract.Mode == mode && contract.PageKind == pageKind {
return
}
}
t.Fatalf("missing resource contract %s/%s with mode %q and page kind %q", domain, name, mode, pageKind)
}