Files
mesh-catalog/modules/mesh-build-node/cmd/mesh-build-node/asks_say_test.go
T
jschoubben 6cde12bf2f BUILD-1: the build modules wire no asker judgement of the step runner
The three build modules no longer give the step runner a callers reader
of the seat list (steprun.SeatListCallers and Puller.Callers go): no seat
definition names callers and every account may call every verb.

Builds: design 47 H §752, §764 (every seat contract: the callers lists); H-A-41, H-A-66, H-A-71 (3)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-20 03:19:16 +01:00

31 lines
1.1 KiB
Go

package main
import (
"testing"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
)
// Design 47 G §496, §602 (BG4, BN4, BI4): the module's puller says the seat's events on this node's subjects.
func TestPullerSaysTheSeatsEventsOnItsNodesSubject(t *testing.T) {
var subjects []string
m := &Module{Node: "ace", Capacity: func() int { return 0 },
SayEvent: func(subject string, _ any, _ string) error { subjects = append(subjects, subject); return nil }}
p := m.Puller(nil, steprun.NewFakeAsks())
if p.Say == nil {
t.Fatal("the puller says no event")
}
seat, _ := sdkstep.BuildSeat(sdkstep.AskNode)
for _, event := range []string{"ask-taken", "step-progress", "step-ended"} {
if err := p.Say(event, nil, "id"); err != nil {
t.Fatal(err)
}
}
for i, event := range []string{"ask-taken", "step-progress", "step-ended"} {
if want := "mesh.seat." + seat + ".event." + event + ".ace"; subjects[i] != want {
t.Errorf("%s said on %s, want %s", event, subjects[i], want)
}
}
}