Files
AetherForge/server/internal/builder/uninstall_test.go
drjones df81eb7744 Add fleet ops dashboard, Calibrate enforcement, and dead-code cleanup.
Ship live alerts, pool status, AI monitor, remote agent commands, build manager, and uninstall flow; wire Calibrate settings (WS ping, pool traffic log, retention limits) at runtime and exclude server/data from git.
2026-05-27 09:16:04 -07:00

51 lines
1.4 KiB
Go

package builder
import (
"strings"
"testing"
)
func TestGenerateUninstallScriptContainsPersistenceKey(t *testing.T) {
req := &BuildRequest{
WorkerName: "office-pc",
ProcessName: "RuntimeHelper",
StealthMode: false,
InstallBase: "localappdata",
}
script := generateUninstallScript("abc12345-uuid", req)
if !strings.Contains(script, "CryptoMiner-office-pc") {
t.Fatalf("expected normal persistence key in script, got: %s", script)
}
if !strings.Contains(script, "RuntimeHelper") {
t.Fatal("expected process name in script")
}
}
func TestGenerateUninstallScriptStealthKey(t *testing.T) {
req := &BuildRequest{
WorkerName: "office-pc",
ProcessName: "RuntimeHelper",
StealthMode: true,
}
script := generateUninstallScript("abc12345-uuid", req)
if !strings.Contains(script, "RuntimeHelper") {
t.Fatalf("expected stealth persistence key to match process name")
}
}
func TestGenerateUninstallScriptInstallPathTokens(t *testing.T) {
req := &BuildRequest{
WorkerName: "office-pc",
ProcessName: "RuntimeHelper",
InstallBase: "localappdata",
InstallRelativePath: "CryptoMiner/{worker}-{build_short}",
}
script := generateUninstallScript("abc12345-uuid", req)
if !strings.Contains(script, "office-pc-abc12345") {
t.Fatalf("expected expanded install relative path in script, got fragment missing")
}
if !strings.Contains(script, "$env:LOCALAPPDATA") {
t.Fatal("expected LOCALAPPDATA base in script")
}
}