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

@@ -70,6 +70,32 @@ func TestAUREnsureInstalledBootstrapsYay(t *testing.T) {
}
}
func TestYayReinstall(t *testing.T) {
r := &aurFakeRunner{yayInstalled: true}
y := NewYay(r)
if err := y.Reinstall(context.Background(), []string{"git", "curl"}); err != nil {
t.Fatal(err)
}
if len(r.runCalls) == 0 {
t.Fatal("expected yay reinstall call")
}
c := r.runCalls[len(r.runCalls)-1]
want := []string{"yay", "-S", "--noconfirm", "git", "curl"}
if len(c) != len(want) {
t.Fatalf("call = %v, want %v", c, want)
}
for i, w := range want {
if c[i] != w {
t.Fatalf("call = %v, want %v", c, want)
}
}
for _, a := range c {
if a == "--needed" {
t.Fatalf("Reinstall must not pass --needed; got %v", c)
}
}
}
func TestAURInstall(t *testing.T) {
r := &aurFakeRunner{yayInstalled: true}
y := NewYay(r)