package main

import "testing"

func TestShouldAutoInstallFirefox(t *testing.T) {
	tests := []struct {
		name         string
		installed    bool
		markerExists bool
		want         bool
	}{
		{
			name:         "missing without marker can install",
			installed:    false,
			markerExists: false,
			want:         true,
		},
		{
			name:         "installed must not reinstall even when unusable",
			installed:    true,
			markerExists: false,
			want:         false,
		},
		{
			name:         "missing with marker must not reinstall",
			installed:    false,
			markerExists: true,
			want:         false,
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := shouldAutoInstallFirefox(tt.installed, tt.markerExists); got != tt.want {
				t.Fatalf("shouldAutoInstallFirefox(%v, %v) = %v, want %v", tt.installed, tt.markerExists, got, tt.want)
			}
		})
	}
}
