Services can resolve legacy aliases and expose the catalog over CLI and HTTP instead of ad-hoc error strings. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
514 B
Go
27 lines
514 B
Go
package domains
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"error-code-system/errcode"
|
|
)
|
|
|
|
func TestEmbeddedCatalogMatchesRegistry(t *testing.T) {
|
|
r := errcode.NewRegistry()
|
|
RegisterAll(r)
|
|
for _, domain := range []string{"sys", "agent", "squad"} {
|
|
got, err := ExportDomain(r, domain)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want, err := CatalogJSON(domain)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !bytes.Equal(got, want) {
|
|
t.Fatalf("%s.json drifted from registry\n got:\n%s\nwant:\n%s", domain, got, want)
|
|
}
|
|
}
|
|
}
|