package backup import ( "context" "strings" "testing" ) // R-240: an off-site run with no app selected reported „Sikeres — nincs mentésre jelölt alkalmazás": // SUCCESSFUL right beside NOTHING SELECTED, the same shape as R-203/R-234 (a warning beside a success // is read as a success). The consequence asserted through the real run: the verdict stays `ok` (an // empty selection is not a failure), the note says plainly that the run saved nothing, it does NOT // say „Sikeres", and it still carries the lowercase marker the R-570 legacy fallback reads. func TestR240_ZeroSelectionRunDoesNotSaySuccess(t *testing.T) { m, sett := newOffboxManager(t) m.SetOffboxRunner(func(_ context.Context, _ []string, args ...string) ([]byte, error) { if contains(args, "cat") && contains(args, "config") { return []byte(`{"version":2}`), nil } return []byte(`[]`), nil }) if err := m.RunOffboxBackup(context.Background()); err != nil { t.Fatalf("zero-selection run must not error: %v", err) } st := sett.GetOffboxTarget() if st.LastStatus != "ok" { t.Errorf("verdict = %q, want ok — an empty selection is not a failure", st.LastStatus) } if strings.Contains(st.LastWarning, "Sikeres") { t.Errorf("R-240: the note for a run that saved nothing still calls itself successful: %q", st.LastWarning) } if !strings.Contains(st.LastWarning, "semmit nem mentett") { t.Errorf("R-240: the note does not say the run saved nothing: %q", st.LastWarning) } if !strings.Contains(st.LastWarning, "nincs mentésre jelölt alkalmazás") { t.Errorf("the R-570 marker is gone from the note: %q", st.LastWarning) } if st.LastWarningKind != OffboxWarnNoAppsSelected { t.Errorf("the kind is not recorded: %q", st.LastWarningKind) } }