From fc90e911741d91d10b76ef8fb96d05c96fc48dc5 Mon Sep 17 00:00:00 2001 From: Joe Julian Date: Sun, 29 Mar 2026 13:37:57 -0700 Subject: [PATCH] test: align rebased path coverage with controller state --- main_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main_test.go b/main_test.go index d2b9252..a819866 100644 --- a/main_test.go +++ b/main_test.go @@ -69,7 +69,7 @@ func TestUISearchBehaviorIsConsistentAcrossDesktopAndPhoneLayouts(t *testing.T) }) u.showEntriesSection() - u.currentPath = []string{"Root", "Internet"} + u.state.NavigateToPath([]string{"Root", "Internet"}) u.search.SetText("climate") u.filter() if got := u.filteredTitles(); !slices.Equal(got, []string{"HVAC"}) { @@ -77,7 +77,7 @@ func TestUISearchBehaviorIsConsistentAcrossDesktopAndPhoneLayouts(t *testing.T) } u.showTemplatesSection() - u.currentPath = []string{"Templates", "Web"} + u.state.NavigateToPath([]string{"Templates", "Web"}) u.search.SetText("infra") u.filter() if got := u.filteredTitles(); !slices.Equal(got, []string{"SSH Login"}) { @@ -112,7 +112,7 @@ func TestUIClearingSearchResetsToCurrentSectionListing(t *testing.T) { }) u.showTemplatesSection() - u.currentPath = []string{"Templates", "Web"} + u.state.NavigateToPath([]string{"Templates", "Web"}) u.search.SetText("ssh") u.filter() if got := u.filteredTitles(); !slices.Equal(got, []string{"SSH Login"}) { @@ -873,7 +873,7 @@ func TestUICreatesEntryWithAllSupportedEditorFields(t *testing.T) { u := newUIWithModel("desktop", vault.Model{}) u.showEntriesSection() - u.currentPath = []string{"Root", "Internet"} + u.state.NavigateToPath([]string{"Root", "Internet"}) u.filter() u.entryID.SetText("bellagio") @@ -929,7 +929,7 @@ func TestUIEditingEntryPathMovesEntryBetweenGroups(t *testing.T) { }, }) u.showEntriesSection() - u.currentPath = []string{"Root", "Internet"} + u.state.NavigateToPath([]string{"Root", "Internet"}) u.filter() u.state.SelectedEntryID = "vault-console" u.loadSelectedEntryIntoEditor() @@ -939,18 +939,19 @@ func TestUIEditingEntryPathMovesEntryBetweenGroups(t *testing.T) { t.Fatalf("saveEntryAction() move error = %v", err) } - u.currentPath = []string{"Root", "Internet"} + u.state.NavigateToPath([]string{"Root", "Internet"}) u.filter() if got := u.filteredTitles(); len(got) != 0 { t.Fatalf("filteredTitles() in old path = %v, want empty after move", got) } - u.currentPath = []string{"Root", "Infrastructure"} + u.state.NavigateToPath([]string{"Root", "Infrastructure"}) u.filter() if got := u.filteredTitles(); !slices.Equal(got, []string{"Vault Console"}) { t.Fatalf("filteredTitles() in new path = %v, want [Vault Console]", got) } + u.state.SelectedEntryID = "vault-console" item, ok := u.selectedEntry() if !ok { t.Fatal("selectedEntry() ok = false, want moved entry")