summaryrefslogtreecommitdiff
path: root/internal/store/index_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-02 10:52:39 +0200
committerPaul Buetow <paul@buetow.org>2026-03-02 10:52:39 +0200
commit1bd6d282d2352870e68654afca3fa4a4ea7195ea (patch)
tree8159f9a453a4b4a61dd5fd45ac442623b6906ea5 /internal/store/index_test.go
parent858b51ff554b823c9cf943723db48224ef130d99 (diff)
store: decouple crypto/git via interfaces (task 402)
Diffstat (limited to 'internal/store/index_test.go')
-rw-r--r--internal/store/index_test.go17
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