package bus import ( "strings" "testing" "git.novox.be/novox/mesh-sdk/go/buscalls" ) // 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, and a reference that is none are refused before the bus is asked. func TestSentGetRefusesWhatIsNoSentObjectsReference(t *testing.T) { digest := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 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"}, } { _, 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) } } }