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

Function TestAttachmentAt_Bounds

internal/mailparse/attachments_test.go:56–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestAttachmentAt_Bounds(t *testing.T) {
57 raw := sampleMultipart()
58 if _, ok := AttachmentAt(raw, 0); !ok {
59 t.Error("index 0 should exist")
60 }
61 if a, ok := AttachmentAt(raw, 1); !ok || a.Filename != "logo.png" {
62 t.Errorf("index 1 should be logo.png, got ok=%v %+v", ok, a)
63 }
64 if _, ok := AttachmentAt(raw, 2); ok {
65 t.Error("index 2 is out of range, want ok=false")
66 }
67 if _, ok := AttachmentAt(raw, -1); ok {
68 t.Error("negative index, want ok=false")
69 }
70}
71
72func TestAttachments_NoneOnPlainMessage(t *testing.T) {
73 plain := []byte("From: a@x.com\r\nSubject: hi\r\nContent-Type: text/plain\r\n\r\njust text, no attachments\r\n")

Callers

nothing calls this directly

Calls 3

sampleMultipartFunction · 0.85
AttachmentAtFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected