package smtpclient

import "testing"

func TestValidateOnionRequiresProxy(t *testing.T) {
	err := validate(Config{Host: "mail.example.onion", Port: "465", Mode: "TLS", ProxyType: "DIRECT"}, "a@example.org", []string{"news@example.org"})
	if err == nil {
		t.Fatal("expected onion proxy validation error")
	}
}

func TestValidateAllowsCleartextOnion(t *testing.T) {
	err := validate(Config{Host: "mail.example.onion", Port: "25", Mode: "", ProxyType: "SOCKS5", ProxyAddress: "127.0.0.1:9050"}, "a@example.org", []string{"news@example.org"})
	if err != nil {
		t.Fatalf("cleartext onion SMTP should be allowed: %v", err)
	}
}
