dumb/handlers/cache_test.go

26 lines
404 B
Go
Raw Normal View History

2024-03-06 20:53:29 +01:00
package handlers
import (
"bytes"
"testing"
)
func TestCache(t *testing.T) {
key := "testkey"
value := []byte("testvalue")
err := setCache(key, value)
if err != nil {
t.Fatalf("unable to set cache, %q\n", err)
}
v, err := getCache[[]byte](key)
if err != nil {
t.Fatalf("unable to get cache, %q\n", err)
}
if !bytes.Equal(v, value) {
t.Fatalf("expected %q, got %q\n", value, v)
}
}