test: align rebased path coverage with controller state

This commit is contained in:
Joe Julian
2026-03-29 13:37:57 -07:00
parent c248b89fcd
commit fc90e91174
+8 -7
View File
@@ -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")