Files
jiang13-bbs/backend/service/attachment_settings_test.go
freefire 61bf9fb48c feat(attach): 附件可配置限额、流式落盘与分阶段上传
管理端可配类型/体积;上传改流式避免整文件进内存;发帖先选再传并拦截未上传提交;提高 Next proxy 体积上限。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 07:33:16 +08:00

37 lines
762 B
Go

package service
import (
"fmt"
"testing"
)
func TestAttachmentExtAllowedLogic(t *testing.T) {
// Normalize + default list contains msi/html
found := false
for _, e := range DefaultAttachmentExts {
if e == "msi" {
found = true
break
}
}
if !found {
t.Fatal("default list should include msi")
}
}
func TestMimeForAttachmentExt(t *testing.T) {
if MimeForAttachmentExt(".pdf") == "application/octet-stream" {
t.Fatal("pdf should have real mime")
}
if MimeForAttachmentExt(".html") != "application/octet-stream" {
t.Fatal("html should be octet-stream")
}
}
func TestFileMaxBytesDefault(t *testing.T) {
if FileMaxBytes != 20<<20 {
t.Fatalf("default FileMaxBytes=%d", FileMaxBytes)
}
_ = fmt.Sprintf("%d", DefaultAttachmentMaxMB)
}