feat: lazysecrets list marks starred and recent entries, and --starred-icon shows the stars

This commit is contained in:
keb committed 2026-10-14 21:24:01 +02:00
1 parent 50156d706e
commit 77e3fcd551
5 files changed
+74 -3

No files matched your search

+28
View File
@@ -223,3 +223,31 @@ func TestErrorsAreOneLine(t *testing.T) {
}
}
}
func TestListMarks(t *testing.T) {
t.Parallel()
az := fake.Azure(0)
var starredLink string
got, _, _ := run(t, Options{Providers: []provider.Provider{az}, MaxAge: time.Minute, Kinds: []string{"secret"},
Mark: func(link, account string) (bool, bool) {
if starredLink == "" && strings.HasSuffix(link, "/db-password") {
starredLink = link
}
return link == starredLink && account == az.ID(), strings.HasSuffix(link, "/api-key")
}})
var starred, recent int
for _, e := range got {
if e.Starred {
starred++
if e.Link != starredLink {
t.Errorf("%s starred", e.Link)
}
}
if e.Recent {
recent++
}
}
if starred != 1 || recent == 0 {
t.Errorf("%d starred, %d recent", starred, recent)
}
}