2019-04-22 02:59:20 +00:00

31 lines
623 B
Go

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)
})
}))
}