package platform

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

func TestUnraidServiceEnabled(t *testing.T) {
	path := filepath.Join(t.TempDir(), "domain.cfg")
	for _, test := range []struct {
		content string
		want    bool
	}{
		{content: "SERVICE=\"enable\"\n", want: true},
		{content: "SERVICE=disable\n", want: false},
		{content: "OTHER=value\n", want: false},
	} {
		if err := os.WriteFile(path, []byte(test.content), 0600); err != nil {
			t.Fatal(err)
		}
		if got := unraidServiceEnabled(path); got != test.want {
			t.Fatalf("content %q: got %v, want %v", test.content, got, test.want)
		}
	}
}
