Add full test suite with unit, integration, and E2E smoke tests.
Introduce test.bat orchestrating Go/Vitest/Playwright phases, expand coverage across server, agent, and dashboard, and document in tests/README.md.
This commit is contained in:
43
server/internal/builder/fusion_upload_limit_test.go
Normal file
43
server/internal/builder/fusion_upload_limit_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"mime/multipart"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type mockMultipartFile struct {
|
||||
*bytes.Reader
|
||||
}
|
||||
|
||||
func (m *mockMultipartFile) Close() error { return nil }
|
||||
|
||||
func newMockFile(data []byte) *mockMultipartFile {
|
||||
return &mockMultipartFile{Reader: bytes.NewReader(data)}
|
||||
}
|
||||
|
||||
func TestSaveUploadedFusionPayloadRejectsDeclaredOversize(t *testing.T) {
|
||||
h := &Handler{dataDir: t.TempDir()}
|
||||
header := &multipart.FileHeader{
|
||||
Filename: "big.mkv",
|
||||
Size: FusionMaxUploadBytes + 1,
|
||||
}
|
||||
f := newMockFile([]byte("x"))
|
||||
_, _, err := h.saveUploadedFusionPayload(f, header)
|
||||
if err == nil {
|
||||
t.Fatal("expected oversize rejection from Content-Length")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSaveUploadedFusionPayloadRejectsUnknownSize(t *testing.T) {
|
||||
h := &Handler{dataDir: t.TempDir()}
|
||||
f := newMockFile([]byte("MZ"))
|
||||
header := &multipart.FileHeader{
|
||||
Filename: "prep.exe",
|
||||
Size: -1,
|
||||
}
|
||||
_, _, err := h.saveUploadedFusionPayload(f, header)
|
||||
if err == nil {
|
||||
t.Fatal("expected error for unknown Content-Length")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user