diff options
Diffstat (limited to 'internal/store/index_test.go')
| -rw-r--r-- | internal/store/index_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/store/index_test.go b/internal/store/index_test.go index 57aea8c..5624b3e 100644 --- a/internal/store/index_test.go +++ b/internal/store/index_test.go @@ -136,6 +136,23 @@ func TestLoadIndexCorrupted(t *testing.T) { } } +func TestLoadIndexMissingEncryptor(t *testing.T) { + ctx := context.Background() + dir := t.TempDir() + indexPath := filepath.Join(dir, "entry.index") + if err := os.WriteFile(indexPath, []byte("ciphertext"), 0o600); err != nil { + t.Fatalf("writing index file: %v", err) + } + + _, err := loadIndex(ctx, indexPath, dir, nil) + if err == nil { + t.Fatal("loadIndex with nil encryptor: expected error, got nil") + } + if !strings.Contains(err.Error(), "missing encryptor") { + t.Fatalf("loadIndex error = %q; want missing encryptor", err.Error()) + } +} + // --- TestIndexSort ----------------------------------------------------------- // TestIndexSort verifies that IndexSlice sorts by Description alphabetically |
