feat: bootstrap foundation application

This commit is contained in:
2026-04-29 00:26:58 -04:00
parent 8e6646499f
commit 4a72e1e030
53 changed files with 4443 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package store
import (
"os"
"path/filepath"
"testing"
)
func TestContentStoreDeduplicatesByHash(t *testing.T) {
root := t.TempDir()
store, err := New(root)
if err != nil {
t.Fatalf("New() error = %v", err)
}
first, err := store.PutBytes([]byte("hello"))
if err != nil {
t.Fatalf("PutBytes() first error = %v", err)
}
second, err := store.PutBytes([]byte("hello"))
if err != nil {
t.Fatalf("PutBytes() second error = %v", err)
}
if first.Hash != second.Hash {
t.Fatalf("hash mismatch: %s != %s", first.Hash, second.Hash)
}
if _, err := os.Stat(filepath.Join(root, first.Hash[0:2], first.Hash[2:4], first.Hash)); err != nil {
t.Fatalf("expected content file to exist: %v", err)
}
}