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

Function TestComposeMessageBasic

internal/outbound/compose_test.go:10–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestComposeMessageBasic(t *testing.T) {
11 raw, err := ComposeMessage(
12 "agent@bot.example.com",
13 []string{"alice@gmail.com"},
14 nil,
15 "Hello Alice",
16 "This is a test message.",
17 "text/plain",
18 "",
19 nil,
20 "relay.e2a.dev",
21 "",
22 "",
23 )
24 if err != nil {
25 t.Fatalf("ComposeMessage failed: %v", err)
26 }
27
28 msg, err := mail.ReadMessage(strings.NewReader(string(raw)))
29 if err != nil {
30 t.Fatalf("failed to parse composed message: %v", err)
31 }
32
33 if got := msg.Header.Get("From"); got != "agent@bot.example.com" {
34 t.Errorf("From = %q, want agent@bot.example.com", got)
35 }
36 if got := msg.Header.Get("To"); got != "alice@gmail.com" {
37 t.Errorf("To = %q, want alice@gmail.com", got)
38 }
39 if got := msg.Header.Get("Subject"); got != "Hello Alice" {
40 t.Errorf("Subject = %q, want Hello Alice", got)
41 }
42 if got := msg.Header.Get("Content-Type"); !strings.Contains(got, "text/plain") {
43 t.Errorf("Content-Type = %q, want text/plain", got)
44 }
45 if got := msg.Header.Get("Mime-Version"); got != "1.0" {
46 t.Errorf("MIME-Version = %q, want 1.0", got)
47 }
48}
49
50func TestComposeMessageSubjectRFC2047Encoding(t *testing.T) {
51 raw, err := ComposeMessage(

Callers

nothing calls this directly

Calls 2

ComposeMessageFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected