MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestMessageViewHeldDraftBody

Function TestMessageViewHeldDraftBody

internal/httpapi/messages_parsed_test.go:88–101  ·  view source on GitHub ↗

Held-draft (pending_approval) messages expose body_text/html via Body, the second representation the unified read serves (sent/inbound use raw_message).

(t *testing.T)

Source from the content-addressed store, hash-verified

86// Held-draft (pending_approval) messages expose body_text/html via Body, the
87// second representation the unified read serves (sent/inbound use raw_message).
88func TestMessageViewHeldDraftBody(t *testing.T) {
89 draft := messageViewFromIdentity(&identity.Message{
90 ID: "msg_d", Direction: "outbound", Status: "pending_review",
91 BodyText: "draft text", BodyHTML: "<p>draft</p>",
92 })
93 if draft.Body == nil || draft.Body.Text != "draft text" || draft.Body.HTML != "<p>draft</p>" {
94 t.Fatalf("held draft should expose body, got %+v", draft.Body)
95 }
96 // A sent/inbound message (no body columns) has no Body.
97 sent := messageViewFromIdentity(&identity.Message{ID: "msg_s", Direction: "inbound", RawMessage: []byte("From: a@x\r\n\r\nhi")})
98 if sent.Body != nil {
99 t.Fatalf("inbound/sent must not carry a draft Body, got %+v", sent.Body)
100 }
101}

Callers

nothing calls this directly

Calls 1

messageViewFromIdentityFunction · 0.85

Tested by

no test coverage detected