Use Android picker for local vaults

This commit is contained in:
Joe Julian
2026-04-07 07:20:39 -07:00
parent a867ac4664
commit e88d1fd875
5 changed files with 83 additions and 4 deletions
+36
View File
@@ -159,6 +159,42 @@ func TestUIMasterPasswordUsesPasswordInputHint(t *testing.T) {
}
}
func TestLocalVaultPathHelpForAndroidUsesChooserLanguage(t *testing.T) {
t.Parallel()
if got := localVaultPathHelpForRuntime("android"); got != "Choose the existing .kdbx file to open." {
t.Fatalf("localVaultPathHelpForRuntime(android) = %q, want chooser guidance", got)
}
}
func TestPickedDocumentNameUsesFileBaseName(t *testing.T) {
t.Parallel()
dir := t.TempDir()
path := filepath.Join(dir, "mint-ledger.kdbx")
if err := os.WriteFile(path, []byte("mint"), 0o600); err != nil {
t.Fatalf("WriteFile(%q) error = %v", path, err)
}
file, err := os.Open(path)
if err != nil {
t.Fatalf("Open(%q) error = %v", path, err)
}
t.Cleanup(func() { _ = file.Close() })
if got := pickedDocumentName(file, "selected-vault.kdbx"); got != "mint-ledger.kdbx" {
t.Fatalf("pickedDocumentName(file, fallback) = %q, want mint-ledger.kdbx", got)
}
}
func TestPickedDocumentNameFallsBackWhenUnnamed(t *testing.T) {
t.Parallel()
reader := io.NopCloser(strings.NewReader("mint"))
if got := pickedDocumentName(reader, "crew-ledger.kdbx"); got != "crew-ledger.kdbx" {
t.Fatalf("pickedDocumentName(reader, fallback) = %q, want crew-ledger.kdbx", got)
}
}
func TestUISearchBehaviorIsConsistentAcrossDesktopAndPhoneLayouts(t *testing.T) {
t.Parallel()