Subtask C: tellerevents' own test goes, its rows are the assigner's ended-ask rows and the teller's decode of every event said, to stay within the test budget (issue 1966)
mesh/delivery merged: source.main moved to novox/mesh-delivery@1fad9c8855a8
mesh/check checking 77f5ec7d4f0a on 8d9683d844ec

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-10 01:10:41 +01:00
parent 46badf078e
commit 77f5ec7d4f
@@ -1,43 +0,0 @@
package tellerevents
import (
"strings"
"testing"
)
// An ended ask goes through its encoding whole, and one lacking a part, or of another shape, is refused naming it.
func TestEnded(t *testing.T) {
whole := Ended{Key: "record.novox.nats.0de05f93", Ask: "record-novox-nats-x", Outcome: "expired"}
for _, c := range []struct {
name string
e Ended
raw string
want string
}{
{name: "whole", e: whole},
{name: "no key", e: Ended{Ask: "a", Outcome: "expired"}, want: "no key"},
{name: "no ask", e: Ended{Key: "k", Outcome: "expired"}, want: "no ask"},
{name: "no outcome", e: Ended{Key: "k", Ask: "a"}, want: "no outcome"},
{name: "unknown field", raw: `{"v":1,"key":"k","ask":"a","outcome":"expired","more":1}`, want: "shape"},
} {
t.Run(c.name, func(t *testing.T) {
raw := []byte(c.raw)
if c.raw == "" {
var err error
if raw, err = EncodeEnded(c.e); err != nil {
if c.want == "" || !strings.Contains(err.Error(), c.want) {
t.Fatalf("EncodeEnded: %v, want %q", err, c.want)
}
return
}
}
got, err := DecodeEnded(raw)
switch {
case c.want != "" && (err == nil || !strings.Contains(err.Error(), c.want)):
t.Fatalf("DecodeEnded: %v, want %q", err, c.want)
case c.want == "" && (err != nil || got.Key != c.e.Key || got.Ask != c.e.Ask || got.Outcome != c.e.Outcome || got.V != 1):
t.Fatalf("DecodeEnded = %+v, %v; want %+v", got, err, c.e)
}
})
}
}