go-common/app/job/main/passport-game-data/service/batch_query_test.go

37 lines
797 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"context"
"encoding/json"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestService_batchQueryCloudByMid(t *testing.T) {
once.Do(startService)
Convey("batch query cloud by mid", t, func() {
mids := []int64{88888970, 88894849}
res, miss := s.batchQueryCloudByMid(context.TODO(), mids, 1)
str, _ := json.Marshal(res)
t.Logf("res: %s", str)
So(len(miss), ShouldEqual, 0)
So(len(res), ShouldEqual, 2)
})
}
func TestService_batchQueryCloudByMidNonMiss(t *testing.T) {
once.Do(startService)
Convey("batch query cloud by mid", t, func() {
mids := []int64{88888970, 88894849}
res := s.batchQueryCloudNonMiss(context.TODO(), mids, 1001, 1)
str, _ := json.Marshal(res)
t.Logf("res: %s", str)
So(len(res), ShouldEqual, 2)
})
}