refactoring

This commit is contained in:
bel
2026-03-08 22:16:53 -06:00
parent d37b6e292f
commit ca3c4d6607
6 changed files with 200 additions and 75 deletions

26
cmd/db_test.go Normal file
View File

@@ -0,0 +1,26 @@
package cmd
import (
"bytes"
"context"
"path"
"testing"
)
func TestCache(t *testing.T) {
ctx := context.Background()
cacheAddr = path.Join(t.TempDir(), "test.db")
c := NewCache(ctx)
k := "k"
v := []byte("v")
if err := c.Set(ctx, k, v); err != nil {
t.Fatal(err)
}
if got, err := c.Get(ctx, k); err != nil {
t.Fatal(err)
} else if !bytes.Equal(v, got) {
t.Fatalf("expected %q but got %q", v, got)
}
}