feat: H shows what's hidden; Spring keys that don't look secret are hidden (#81)
Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
This commit was merged in pull request #81.
This commit is contained in:
1 parent
17da9eaa32
commit
913b3db6a9
19 files changed
+323
-74
No files matched your search
@@ -3,6 +3,12 @@ package panes
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/provider"
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/ui/icons"
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/ui/styles"
|
||||
)
|
||||
|
||||
func TestWrappedValueKeepsItsStyle(t *testing.T) {
|
||||
@@ -15,3 +21,17 @@ func TestWrappedValueKeepsItsStyle(t *testing.T) {
|
||||
t.Errorf("the style went on past its reset: %q", got[2])
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyValue(t *testing.T) {
|
||||
d := NewDetail(icons.None)
|
||||
d.SetSize(80, 20)
|
||||
d.ShowSecret(provider.Object{Name: "spring.datasource.password", Type: provider.TypeSecret})
|
||||
d.SetValue(provider.NewSecretValue(nil))
|
||||
if view := ansi.Strip(d.View(styles.Default(), true, "")); !strings.Contains(view, "∅ no value (an empty string)") {
|
||||
t.Errorf("empty value:\n%s", view)
|
||||
}
|
||||
d.SetValue(provider.NewSecretValue([]byte("empty")))
|
||||
if view := ansi.Strip(d.View(styles.Default(), true, "")); strings.Contains(view, "∅") || !strings.Contains(view, "empty") {
|
||||
t.Errorf("the word empty:\n%s", view)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user