Improve portable launch, forge persistence, and operator auth UX.
Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -135,6 +136,47 @@ func TestPrepareFusionProjectMissingSource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrepareFusionProjectSuccess(t *testing.T) {
|
||||
h, database := testHandlerDB(t)
|
||||
defer database.Close()
|
||||
|
||||
fusionDir, err := h.prepareFusionProject(t.TempDir(), "prep_first", "file", "paired", "report.pdf")
|
||||
if err != nil {
|
||||
t.Fatalf("prepareFusionProject: %v", err)
|
||||
}
|
||||
main, err := os.ReadFile(filepath.Join(fusionDir, "main.go"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
body := string(main)
|
||||
for _, want := range []string{`runOrder = "prep_first"`, `payloadKind = "file"`, `mediaFileName = "report.pdf"`} {
|
||||
if !strings.Contains(body, want) {
|
||||
t.Fatalf("patched main missing %q:\n%s", want, body)
|
||||
}
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(fusionDir, "go.mod")); err != nil {
|
||||
t.Fatalf("fusion go.mod not copied: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildFileFusionMissingWorker(t *testing.T) {
|
||||
h, database := testHandlerDB(t)
|
||||
defer database.Close()
|
||||
setFakeGoSuccess(t, h)
|
||||
|
||||
buildDir := t.TempDir()
|
||||
prep := filepath.Join(t.TempDir(), "report.pdf")
|
||||
if err := os.WriteFile(prep, []byte("%PDF"), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
req := &BuildRequest{FusionMediaMode: "paired", FusionPayloadKind: "file"}
|
||||
win := BuildPlatform{GOOS: "windows", GOARCH: "amd64", Ext: ".exe"}
|
||||
_, err := h.buildFileFusion(context.Background(), buildDir, prep, filepath.Join(buildDir, "missing.exe"), req, win)
|
||||
if err == nil {
|
||||
t.Fatal("expected worker copy failure")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPublishFusionDeliverable(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
h := &Handler{projectRoot: root}
|
||||
|
||||
Reference in New Issue
Block a user