feat(platform): add Reinstall helpers to Pacman and Yay
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user