//go:build !windows && !plan9 && !wasm && !tamago

package paths

import (
	"os"
	"runtime"
	"testing"

	"tailscale.com/util/miragebrand"
)

func TestDefaultTailscaledSocketUsesMiragePathWhenBranded(t *testing.T) {
	if runtime.GOOS != "linux" {
		t.Skip("linux branding test")
	}
	oldArgs := os.Args
	os.Args = []string{"/usr/bin/mirage"}
	t.Cleanup(func() { os.Args = oldArgs })

	if got, want := DefaultTailscaledSocket(), miragebrand.LinuxSocketPath(); got != want {
		t.Fatalf("DefaultTailscaledSocket() = %q, want %q", got, want)
	}
}

func TestStatePathUsesMiragePathWhenBranded(t *testing.T) {
	if runtime.GOOS != "linux" {
		t.Skip("linux branding test")
	}
	oldArgs := os.Args
	os.Args = []string{"/usr/bin/miraged"}
	t.Cleanup(func() { os.Args = oldArgs })

	if got, want := statePath(), miragebrand.LinuxStateFile(); got != want {
		t.Fatalf("statePath() = %q, want %q", got, want)
	}
}
