The gate's and the assigner's asks carry the router's ask as its JSON, so mesh-sdk names no type of a seat defined whole; the ask's id, options, digest and an option's level are read by the gate, the assigner and the teller through operatorchannelclient. ViewAnswerFits keeps the asking's check, from the key. The channel and intake benches are not defined whole: their shapes move to go/channel (ADR 0625 §9). Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package channel
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestTheSubjectsNameTheirPublisher(t *testing.T) {
|
|
for got, want := range map[string]string{
|
|
ChannelSubject(Show, "telegram"): "mesh.seat.channel.accept.show.telegram",
|
|
IntakeSubject(Chosen, "desktop"): "mesh.seat.intake.event.choice.desktop",
|
|
ProofSubject(CodeProof, "telegram"): "mesh.seat.intake.proof.code.telegram",
|
|
} {
|
|
if got != want {
|
|
t.Errorf("%s, want %s", got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
// A message's note travels beside its body, and is left out of the encoding when empty, so a channel older
|
|
// than it reads every message it read before.
|
|
func TestAMessageCarriesItsNoteApart(t *testing.T) {
|
|
raw, _ := json.Marshal(Message{Handle: "h", Title: "t", Body: "b", Note: "Asked by x."})
|
|
if !strings.Contains(string(raw), `"note":"Asked by x."`) {
|
|
t.Fatalf("the note is not encoded: %s", raw)
|
|
}
|
|
raw, _ = json.Marshal(Message{Handle: "h", Title: "t"})
|
|
if strings.Contains(string(raw), "note") {
|
|
t.Fatalf("an empty note is encoded: %s", raw)
|
|
}
|
|
}
|