Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
package service
import (
"context"
"testing"
artmdl "go-common/app/interface/openplatform/article/model"
. "github.com/smartystreets/goconvey/convey"
)
func Test_Stat(t *testing.T) {
var (
err error
c = context.TODO()
statCnt = int64(5)
stat = &artmdl.StatMsg{
Aid: 88,
View: &statCnt,
Favorite: &statCnt,
Like: &statCnt,
Dislike: &statCnt,
Reply: &statCnt,
Share: &statCnt,
}
)
Convey("updateCache", t, WithoutProcService(func(s *Service) {
err = s.updateCache(c, stat, 0)
So(err, ShouldBeNil)
}))
Convey("updateDB", t, WithoutProcService(func(s *Service) {
err = s.updateDB(c, stat, 0)
So(err, ShouldBeNil)
}))
Convey("select Stat", t, WithoutProcService(func(s *Service) {
var stat *artmdl.StatMsg
stat, err = s.dao.Stat(c, 1)
So(err, ShouldBeNil)
So(stat, ShouldNotBeEmpty)
}))
}