2026-07-02 10:53:44 +08:00

43 lines
1.1 KiB
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 financeapplication
import (
"strings"
"testing"
"time"
)
func TestFinanceApplicationCreatedMarkdown(t *testing.T) {
text := financeApplicationCreatedMarkdown(applicationDTO{
ID: 12,
AppCode: "lalu",
Operation: "coin_seller_coin_credit",
TargetUserID: "10001",
CoinAmount: 1000,
RechargeAmount: "10.50",
CredentialImageURL: "https://example.com/receipt.png",
CredentialText: "bank order\nabc",
ApplicantUserID: 7,
ApplicantName: "ops",
CreatedAtMS: time.Date(2026, 7, 1, 1, 2, 3, 0, time.UTC).UnixMilli(),
})
for _, want := range []string{
"### 财务申请待审核",
"- APPlalu",
"- 操作:增加币商金币",
"- 目标用户ID10001",
"- 金币数量1000",
"- 充值金额 $ 10.50",
"- 申请人ops(7)",
"- 发起时间2026-07-01 09:02:03",
"- 后台地址https://admin-acc.global-interaction.com/finance/",
"- 凭证文字bank order abc",
"- 凭证图片:",
"![凭证图片](https://example.com/receipt.png)",
} {
if !strings.Contains(text, want) {
t.Fatalf("markdown missing %q:\n%s", want, text)
}
}
}