Limit group view to direct entries
This commit is contained in:
@@ -44,13 +44,14 @@ func TestVisibleEntriesFollowsCurrentPathWithoutSearch(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestVisibleEntriesIncludesDescendantEntriesAtParentGroup(t *testing.T) {
|
||||
func TestVisibleEntriesAtParentGroupOnlyShowsDirectEntries(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
state := State{
|
||||
Session: stubSession{
|
||||
model: vault.Model{
|
||||
Entries: []vault.Entry{
|
||||
{ID: "joe-note", Title: "Crew Note", Path: []string{"Crew"}},
|
||||
{ID: "bellagio", Title: "Bellagio", Path: []string{"Crew", "Internet"}},
|
||||
{ID: "vault-console", Title: "Vault Console", Path: []string{"Crew", "Internet"}},
|
||||
{ID: "surveillance-console", Title: "Surveillance Console", Path: []string{"Crew", "Home Assistant"}},
|
||||
@@ -69,8 +70,8 @@ func TestVisibleEntriesIncludesDescendantEntriesAtParentGroup(t *testing.T) {
|
||||
for _, entry := range got {
|
||||
titles = append(titles, entry.Title)
|
||||
}
|
||||
if !slices.Equal(titles, []string{"Bellagio", "Vault Console", "Surveillance Console"}) {
|
||||
t.Fatalf("visible titles = %v, want descendant entries from Crew", titles)
|
||||
if !slices.Equal(titles, []string{"Crew Note"}) {
|
||||
t.Fatalf("visible titles = %v, want only direct entries from Crew", titles)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,8 +221,8 @@ func TestVisibleEntriesReturnsDescendantsAfterClearingSearch(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("VisibleEntries() after clearing search error = %v", err)
|
||||
}
|
||||
if len(got) != 3 {
|
||||
t.Fatalf("len(VisibleEntries()) after clearing search = %d, want 3 descendant entries", len(got))
|
||||
if len(got) != 0 {
|
||||
t.Fatalf("len(VisibleEntries()) after clearing search = %d, want 0 direct entries at Crew", len(got))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user