package link import ( "slices" "testing" "git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest" ) // The seats the tests judge against are given to catalogue as the node-engine gives the ones it read from the bus // (novox/hq ADR 0635 ยง1); catalogue compiles none. func init() { catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) } // Before the engine holds a seat list it serves its seat's verbs from the bootstrapped definition (issue 1966: served from // the empty list, it answered no verb and the assigner kept an old statement). func TestServedEngineSeatBeforeTheList(t *testing.T) { held := catalogue.Seats() defer catalogue.UseSeats(held) for _, tc := range []struct { name string seats []catalogue.Seat }{{"no list held", nil}, {"list held", held}} { catalogue.UseSeats(tc.seats) var names []string for _, v := range ServedEngineSeat().Serves { names = append(names, v.Name) } for _, want := range []string{ActManifestReads, ActComposition, ActHandOver} { if !slices.Contains(names, want) { t.Errorf("%s: the engine serves %v, without %s", tc.name, names, want) } } } }