feat(mail): draft, attach, and draft-invoice CLI

Save OO Mail drafts via body field, attach Files documents, and one-shot
invoice PDF regenerate + draft for client billing emails.
This commit is contained in:
2026-08-06 13:18:02 +01:00
parent d81e7de911
commit 73b1050a83
4 changed files with 357 additions and 4 deletions
+24 -1
View File
@@ -1,6 +1,9 @@
package onlyoffice
import "testing"
import (
"strings"
"testing"
)
func TestResolveMailFolder(t *testing.T) {
tests := []struct {
@@ -70,3 +73,23 @@ func TestMailMessagesAsTableRows(t *testing.T) {
t.Fatalf("got %+v", rows[0])
}
}
func TestPlainTextToMailHTML(t *testing.T) {
got := PlainTextToMailHTML("Hello\n\nWorld\nline2")
if !strings.Contains(got, "<p>Hello</p>") || !strings.Contains(got, "World<br/>line2") {
t.Fatalf("got %q", got)
}
html := "<p>Already</p>"
if PlainTextToMailHTML(html) != html {
t.Fatalf("html passthrough failed")
}
}
func TestInt64FromMap(t *testing.T) {
if Int64FromMap(map[string]any{"id": float64(99)}, "id") != 99 {
t.Fatal("float64")
}
if Int64FromMap(map[string]any{"id": "42"}, "id") != 42 {
t.Fatal("string")
}
}