初始化
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func TestImportScriptAnalysisFileRejectsUnsupportedFormat(t *testing.T) {
|
||||
service := &Creative{}
|
||||
_, err := service.ImportScriptAnalysisFile(uuid.New(), uuid.New(), "script.docx", []byte("content"))
|
||||
if err == nil || !strings.Contains(err.Error(), "仅支持TXT和DOC文件") {
|
||||
t.Fatalf("expected unsupported format error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportScriptAnalysisFileRejectsOversizedFile(t *testing.T) {
|
||||
service := &Creative{}
|
||||
_, err := service.ImportScriptAnalysisFile(uuid.New(), uuid.New(), "script.txt", make([]byte, maxDramaImportBytes+1))
|
||||
if err == nil || !strings.Contains(err.Error(), "不能超过3MB") {
|
||||
t.Fatalf("expected file size error, got %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user