Files
mesh-catalog/modules/nats/cmd/nats-tools/catalogview_test.go
T
jschoubben e4ef67adcd MV1: move contracts and sdk under modules/, importers follow
The delivery repository's contracts and SDK live under modules/ as
mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths
renamed to match the folders (the TypeScript names already did), and
every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools
and mesh-sdk follows in the same group: a design as it should be, one
path per module, checked by the group's check building every importer.

Builds: design 47 G §427, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:09:56 +01:00

29 lines
992 B
Go

package main
import (
"testing"
catalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
)
func TestAsksOf(t *testing.T) {
m := map[string]any{"module": "m", "claims": []any{map[string]any{"name": "seat-a"}}, "emits": []any{"done"}}
a, err := AsksOf(catalog.CatalogEntry{Module: "m", Verdict: "accepted", Manifest: m})
if err != nil {
t.Fatal(err)
}
if len(a.Claims) != 1 || a.Claims[0] != "seat-a" || !a.EmitsOwn || a.Accepted.Module != "m" || a.Accepted.Digest == "" {
t.Errorf("read %+v", a)
}
b, _ := AsksOf(catalog.CatalogEntry{Module: "m", Manifest: map[string]any{"module": "m"}})
if b.EmitsOwn || len(b.Claims) != 0 {
t.Errorf("an entry with neither: %+v", b)
}
if b.Accepted.Digest != a.Accepted.Digest {
t.Errorf("the digest is of the bus-state asked alone: %s vs %s", b.Accepted.Digest, a.Accepted.Digest)
}
if _, err := AsksOf(catalog.CatalogEntry{}); err == nil {
t.Error("an entry with no module was read")
}
}