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:
drjones
2026-05-29 10:04:52 -07:00
parent f9e26bb1a6
commit e55f11a657
23 changed files with 1052 additions and 12 deletions

View 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")
}
}