feat(fonts): implement PlanForce to reinstall all fonts via yay

This commit is contained in:
MDietermann
2026-04-14 21:56:23 +02:00
parent c75afade8c
commit c056697721
2 changed files with 43 additions and 2 deletions

View File

@@ -69,4 +69,31 @@ func TestFontsDetectPresentNoActions(t *testing.T) {
}
}
func TestPlanForceReinstallsAllFonts(t *testing.T) {
r := &fakeRunner{installed: map[string]bool{"yay": true, "ttf-jetbrains-mono-nerd": true}}
m := New([]string{"ttf-jetbrains-mono-nerd"}, platform.NewPacman(r), platform.NewYay(r))
plan, err := m.PlanForce(context.Background())
if err != nil {
t.Fatalf("PlanForce: %v", err)
}
if plan.IsEmpty() {
t.Fatal("force plan must not be empty")
}
for _, a := range plan.Actions {
if err := a.Exec(context.Background()); err != nil {
t.Fatalf("Exec: %v", err)
}
}
sawReinstall := false
for _, c := range r.runCalls {
// yay -S --noconfirm ... (no --needed)
if len(c) >= 3 && c[0] == "yay" && c[1] == "-S" && c[2] == "--noconfirm" {
sawReinstall = true
}
}
if !sawReinstall {
t.Fatalf("no yay reinstall (-S --noconfirm, no --needed) call; calls=%v", r.runCalls)
}
}
var _ module.Module = Module{}