Create & Init Project...
This commit is contained in:
30
app/interface/openplatform/article/dao/redis_like_test.go
Normal file
30
app/interface/openplatform/article/dao/redis_like_test.go
Normal file
@ -0,0 +1,30 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func Test_MaxLikeCache(t *testing.T) {
|
||||
var (
|
||||
aid = int64(100)
|
||||
value = int64(200)
|
||||
err error
|
||||
)
|
||||
Convey("add cache", t, WithCleanCache(func() {
|
||||
err = d.SetMaxLikeCache(context.TODO(), aid, value)
|
||||
So(err, ShouldBeNil)
|
||||
Convey("get cache", func() {
|
||||
res, err := d.MaxLikeCache(context.TODO(), aid)
|
||||
So(err, ShouldBeNil)
|
||||
So(res, ShouldEqual, value)
|
||||
})
|
||||
Convey("expire cache", func() {
|
||||
res, err := d.ExpireMaxLikeCache(context.TODO(), aid)
|
||||
So(err, ShouldBeNil)
|
||||
So(res, ShouldEqual, true)
|
||||
})
|
||||
}))
|
||||
}
|
Reference in New Issue
Block a user