You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
891 B

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)
}
})
}
}