package nsc

import "testing"

func TestMacOSRunnerWorkDirUsesWritableEphemeralPath(t *testing.T) {
	cases := []struct {
		name       string
		configured string
		want       string
	}{
		{name: "empty", configured: "", want: "/tmp/forgejo-runner"},
		{name: "linux var state", configured: "/var/lib/forgejo-runner", want: "/tmp/forgejo-runner"},
		{name: "custom tmp", configured: "/tmp/custom-runner", want: "/tmp/custom-runner"},
		{name: "home path", configured: "/Users/runner/forgejo-runner", want: "/Users/runner/forgejo-runner"},
	}

	for _, tc := range cases {
		t.Run(tc.name, func(t *testing.T) {
			got := macosRunnerWorkDir(tc.configured)
			if got != tc.want {
				t.Fatalf("macosRunnerWorkDir(%q) = %q, want %q", tc.configured, got, tc.want)
			}
		})
	}
}
