Skip to content

Commit ae08e17

Browse files
committed
imapclient: add basic Append test
1 parent 706a216 commit ae08e17

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

imapclient/append_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package imapclient_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/emersion/go-imap/v2"
7+
)
8+
9+
func TestAppend(t *testing.T) {
10+
client, server := newClientServerPair(t, imap.ConnStateSelected)
11+
defer client.Close()
12+
defer server.Close()
13+
14+
body := "This is a test message."
15+
16+
appendCmd := client.Append("INBOX", int64(len(body)), nil)
17+
if _, err := appendCmd.Write([]byte(body)); err != nil {
18+
t.Fatalf("AppendCommand.Write() = %v", err)
19+
}
20+
if err := appendCmd.Close(); err != nil {
21+
t.Fatalf("AppendCommand.Close() = %v", err)
22+
}
23+
if _, err := appendCmd.Wait(); err != nil {
24+
t.Fatalf("AppendCommand.Wait() = %v", err)
25+
}
26+
27+
// TODO: fetch back message and check body
28+
}

0 commit comments

Comments
 (0)