mesh/objects.sent-get reads a sender's sent store only; refused: a state's objects, a reference that is none, an object over a bundle's channel. Builds: design 47 G §347, §59, §462 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
package bus
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/buscalls"
|
|
"git.novox.be/novox/mesh-sdk/go/stateobjects"
|
|
)
|
|
|
|
// Design 47 G §347, §59, §462: a sent object is read by the reference that carried it, from a sender's sent store only; a
|
|
// state's objects, a reference that is none and an object too large for a bundle's channel are refused before the bus is asked.
|
|
func TestSentGetRefusesWhatIsNoSentObjectsReference(t *testing.T) {
|
|
digest := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
big := int64(stateobjects.BundleObjectMost) + 1
|
|
for _, c := range []struct {
|
|
name string
|
|
req buscalls.ObjectsSentGetRequest
|
|
want string
|
|
}{
|
|
{"no digest", buscalls.ObjectsSentGetRequest{Store: "m_sent-objects", Object: "o", Size: 3}, "named by the reference"},
|
|
{"a state's objects", buscalls.ObjectsSentGetRequest{Store: "m_asks-objects", Object: "o", Size: 3, Digest: digest}, "no sent store"},
|
|
{"over the channel", buscalls.ObjectsSentGetRequest{Store: "m_sent-objects", Object: "o", Size: big, Digest: digest}, "not read through a bundle"},
|
|
} {
|
|
_, err := (&Conn{}).SentGet(c.req)
|
|
if err == nil || !strings.Contains(err.Error(), c.want) {
|
|
t.Errorf("%s: got %v, want an error containing %q", c.name, err, c.want)
|
|
}
|
|
}
|
|
}
|