feat(platform): add Reinstall helpers to Pacman and Yay

This commit is contained in:
MDietermann
2026-04-14 21:44:47 +02:00
parent 1cd3886d56
commit e6e12ab5fd
4 changed files with 69 additions and 0 deletions

View File

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