Files
artalkjs/internal/cache/base_test.go
qwqcode cf7725edba refactor(go): bump the module version and support go install (#979)
BREAKING CHANGE: The original Go module name was `github.com/ArtalkJS/Artalk`, which has now been modified to `github.com/artalkjs/artalk/v2` (all lowercase). This change may affect the CI pipeline or other areas if you are compiling the Artalk server and have specified the fixed Go module name. Regarding the original `-ldflags -X github.com/ArtalkJS/Artalk/internal/config.Version` and `CommitHash` definitions, please remove them, as they are now obsolete. The `Version` has been hardcoded into the Go code, and the `CommitHash` is now read from the Go build info via runtime/debug’s vcs.revision value. This change only affects the server developers and does not impact the frontend UI client.
2024-09-18 21:43:43 +08:00

28 lines
482 B
Go

package cache_test
import (
"testing"
"github.com/artalkjs/artalk/v2/internal/cache"
"github.com/artalkjs/artalk/v2/internal/config"
"github.com/stretchr/testify/assert"
)
func newTestCache(t *testing.T) *cache.Cache {
cache, err := cache.New(config.CacheConf{
Enabled: true,
Type: config.CacheTypeBuiltin,
})
if err != nil {
t.Fatal(err)
}
return cache
}
func TestNew(t *testing.T) {
cache := newTestCache(t)
defer cache.Close()
assert.NotNil(t, cache)
}