feat(platform): add Reinstall helpers to Pacman and Yay
This commit is contained in:
@@ -39,6 +39,27 @@ func TestPacmanInstallShellsOutCorrectly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPacmanReinstall(t *testing.T) {
|
||||
r := &fakeRunner{}
|
||||
p := NewPacman(r)
|
||||
if err := p.Reinstall(context.Background(), []string{"git", "curl"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(r.runCalls) != 1 {
|
||||
t.Fatalf("run calls = %d", len(r.runCalls))
|
||||
}
|
||||
got := r.runCalls[0]
|
||||
want := []string{"sudo", "pacman", "-S", "--noconfirm", "git", "curl"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("args = %v, want %v", got, want)
|
||||
}
|
||||
for _, a := range got {
|
||||
if a == "--needed" {
|
||||
t.Fatalf("Reinstall must not pass --needed; got %v", got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPacmanInstallEmptyIsNoop(t *testing.T) {
|
||||
r := &fakeRunner{}
|
||||
p := NewPacman(r)
|
||||
|
||||
Reference in New Issue
Block a user