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,38 @@
package dao
import (
"context"
"testing"
"time"
. "github.com/smartystreets/goconvey/convey"
)
func Test_RecommendByCategory(t *testing.T) {
Convey("get data", t, WithMysql(func(d *Dao) {
res, err := d.RecommendByCategory(context.TODO(), 0)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
}))
Convey("no data", t, WithMysql(func(d *Dao) {
res, err := d.RecommendByCategory(context.TODO(), 1000)
So(err, ShouldBeNil)
So(res, ShouldBeEmpty)
}))
}
func Test_AllRecommendCount(t *testing.T) {
Convey("get data", t, func() {
res, err := d.AllRecommendCount(context.TODO(), time.Now())
So(err, ShouldBeNil)
So(res, ShouldBeGreaterThan, 0)
})
}
func Test_AllRecommends(t *testing.T) {
Convey("get data", t, func() {
res, err := d.AllRecommends(context.TODO(), time.Now(), 1, 5)
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}