H-1: the node-engine claims its seat, says its findings on its own stream and hears running
Builds: design 47 G §364, §387, §199, §368, §411, §438 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -26,3 +26,42 @@ func TestTheSettledEventIsTheManifestsConsume(t *testing.T) {
|
||||
t.Errorf("the engine hears %s, its manifest consumes %v", settledEvent, m.Consumes)
|
||||
}
|
||||
}
|
||||
|
||||
// The manifest claims the seat node-engine, says its findings on its own stream and hears the keeper's ask and the
|
||||
// node-engine seat's running (design 47 G §364, §387, §199).
|
||||
func TestTheManifestClaimsItsSeatAndSaysItsFindings(t *testing.T) {
|
||||
raw, err := os.ReadFile("../../module.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var m struct {
|
||||
Version string `json:"version"`
|
||||
Consumes []string `json:"consumes"`
|
||||
Claims []struct {
|
||||
Name string `json:"name"`
|
||||
Scope string `json:"scope"`
|
||||
} `json:"claims"`
|
||||
Streams []struct {
|
||||
Name string `json:"name"`
|
||||
Events []string `json:"events"`
|
||||
} `json:"streams"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &m); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != "node-engine" || m.Claims[0].Scope != "node" {
|
||||
t.Errorf("claims = %+v, want the node seat node-engine", m.Claims)
|
||||
}
|
||||
if len(m.Streams) != 1 || m.Streams[0].Name != "mesh-host-findings" ||
|
||||
!slices.Equal(m.Streams[0].Events, []string{"finding-written.*", "finding-cleared.*", "findings-stated.*"}) {
|
||||
t.Errorf("streams = %+v, want mesh-host-findings with the three finding events", m.Streams)
|
||||
}
|
||||
for _, c := range []string{"mesh-conditions.findings-asked", "node-engine.running"} {
|
||||
if !slices.Contains(m.Consumes, c) {
|
||||
t.Errorf("consumes %v lacks %s", m.Consumes, c)
|
||||
}
|
||||
}
|
||||
if m.Version != "0.1" {
|
||||
t.Errorf("version = %q, want MAJOR.MINOR 0.1 (§368, §411)", m.Version)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user