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

Function TestAttachments_OrderAndDecode

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

Source from the content-addressed store, hash-verified

35}
36
37func TestAttachments_OrderAndDecode(t *testing.T) {
38 atts := Attachments(sampleMultipart())
39 if len(atts) != 2 {
40 t.Fatalf("want 2 attachments (text body excluded), got %d: %+v", len(atts), atts)
41 }
42 if atts[0].Filename != "report.pdf" || atts[0].ContentType != "application/pdf" {
43 t.Errorf("att0 meta wrong: %+v", atts[0])
44 }
45 if string(atts[0].Data) != "%PDF-1.4 fake pdf bytes" {
46 t.Errorf("att0 bytes not decoded: %q", atts[0].Data)
47 }
48 if atts[1].Filename != "logo.png" || atts[1].ContentType != "image/png" {
49 t.Errorf("att1 meta wrong: %+v", atts[1])
50 }
51 if !bytes.Equal(atts[1].Data, []byte("\x89PNG\r\n fake png")) {
52 t.Errorf("att1 binary bytes not decoded: %q", atts[1].Data)
53 }
54}
55
56func TestAttachmentAt_Bounds(t *testing.T) {
57 raw := sampleMultipart()

Callers

nothing calls this directly

Calls 2

AttachmentsFunction · 0.85
sampleMultipartFunction · 0.85

Tested by

no test coverage detected