internal/imap/handler_test.go (view raw)
1package imap
2
3import (
4 "testing"
5
6 "postern/internal/model"
7)
8
9func TestHasChildren(t *testing.T) {
10 mailboxes := []model.Mailbox{
11 {
12 Name: "Trash",
13 },
14 {
15 Name: "Trash/deleted",
16 },
17 }
18
19 hasChildren := calcHasChildren(mailboxes)
20
21 if !hasChildren["Trash"] {
22 t.Error("expected trash to have a child")
23 }
24 if hasChildren["Trash/deleted"] {
25 t.Error("expected trashed folder to not have a child")
26 }
27}