fix9-4: the mesh-wants wanted stream keeps each want's last word with no age limit
The generated contract is unchanged by seatgen (the keep is read from the definition). Builds: design 47 G A-114 (§693, A-61)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package grants
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
||||
)
|
||||
|
||||
// Design 47 G A-114 (§693, A-61): the seat mesh-wants' `wanted` stream keeps the last message of each subject with no age
|
||||
// limit, so each want's last word is read whole at a start.
|
||||
func TestWantedKeepsEachWantsLastWordWithNoAgeLimit(t *testing.T) {
|
||||
raw, err := os.ReadFile(filepath.Join("..", "..", "..", "..", "contracts", "seats", "mesh-wants", "seat.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
d, err := seatdef.Parse(raw)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, e := range d.Events {
|
||||
if e.Name != "wanted" {
|
||||
continue
|
||||
}
|
||||
if !e.KeptLastPerSubject() || e.KeptAgeDays() != 0 {
|
||||
t.Errorf("wanted keeps last-per-subject %v for %d days, want true and 0 (no age limit)", e.KeptLastPerSubject(), e.KeptAgeDays())
|
||||
}
|
||||
return
|
||||
}
|
||||
t.Fatal("the seat mesh-wants has no event wanted")
|
||||
}
|
||||
Reference in New Issue
Block a user