Share hidden vault root logic across UI and API

This commit is contained in:
Joe Julian
2026-04-11 11:26:00 -07:00
parent ebb8d4f4ff
commit c8f91b300b
5 changed files with 121 additions and 28 deletions
+26
View File
@@ -0,0 +1,26 @@
package vaultview
import (
"testing"
"git.julianfamily.org/keepassgo/internal/vault"
)
func TestHiddenRootIgnoresRecycleBin(t *testing.T) {
t.Parallel()
model := vault.Model{
Entries: []vault.Entry{
{ID: "entry-1", Title: "Vault Console", Path: []string{"keepass", "Crew", "Internet"}},
},
Groups: [][]string{
{"keepass"},
{"keepass", "Crew"},
{"Recycle Bin"},
},
}
if got := HiddenRoot(model); got != "keepass" {
t.Fatalf("HiddenRoot() = %q, want %q", got, "keepass")
}
}