Smail/test/backend/send_log_result_test.go
smail dd6258c98b
Some checks are pending
Security Checks / security (push) Waiting to run
补齐三类日志的触发操作和结果并完善运行事件展示
2026-09-09 02:48:07 +08:00

24 lines
633 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package send
import "testing"
func TestDeliveryLogResultUsesConfirmedRecipientCount(t *testing.T) {
for _, item := range []struct {
accepted, total int
failed bool
want string
}{
{3, 3, false, "accepted"},
{1, 3, true, "partial"},
{1, 3, false, "partial"},
{3, 3, true, "partial"},
{0, 3, true, "failure"},
{0, 3, false, "unknown"},
{0, 0, false, "unknown"},
} {
if got := deliveryLogResult(item.accepted, item.total, item.failed); got != item.want {
t.Fatalf("接收人数 %d/%d,失败=%v:得到 %s,期望 %s", item.accepted, item.total, item.failed, got, item.want)
}
}
}