Files
mesh-delivery/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/nodeengineentry_test.go
T

27 lines
1.0 KiB
Go

package main
import (
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
)
// The module claiming the seat node-engine is found by its served verbs, in the catalog's form `seat:<seat>.<verb>`
// and in the bare form (live, 2026-11-16: every composition step said "holds no module claiming the seat node-engine").
func TestTheNodeEngineEntryIsFoundByItsServedVerbs(t *testing.T) {
for _, c := range []struct {
name string
serves []string
found bool
}{
{"the catalog's seat form", []string{"seat:node-engine.compose", "seat:node-engine.acts"}, true},
{"the bare form", []string{"node-engine.compose"}, true},
{"another seat", []string{"seat:node-engine-x.compose", "seat:mesh-wants.ask"}, false},
} {
e, ok := nodeEngineEntry(map[string]meshcatalog.CatalogEntry{"other": {Serves: []string{"seat:mesh-builds.ask"}}, "engine": {Serves: c.serves}})
if ok != c.found || (ok && e.Serves[0] != c.serves[0]) {
t.Errorf("%s: found %v (%v), want %v", c.name, ok, e.Serves, c.found)
}
}
}