123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- package dao
- import (
- "context"
- "go-common/app/admin/main/search/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoQueryConf(t *testing.T) {
- convey.Convey("QueryConf", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.QueryConf(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoQueryBasic(t *testing.T) {
- convey.Convey("QueryBasic", t, func(ctx convey.C) {
- var (
- c = context.Background()
- sp = &model.QueryParams{
- QueryBody: &model.QueryBody{},
- }
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- mixedQuery, qbDebug := d.QueryBasic(c, sp)
- ctx.Convey("Then mixedQuery,qbDebug should not be nil.", func(ctx convey.C) {
- ctx.So(qbDebug, convey.ShouldNotBeNil)
- ctx.So(mixedQuery, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoqueryBasicRange(t *testing.T) {
- convey.Convey("queryBasicRange", t, func(ctx convey.C) {
- var (
- rangeMap map[string]string
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rangeQuery, err := d.queryBasicRange(rangeMap)
- ctx.Convey("Then err should be nil.rangeQuery should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rangeQuery, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoqueryBasicLike(t *testing.T) {
- convey.Convey("queryBasicLike", t, func(ctx convey.C) {
- var (
- likeMap = []model.QueryBodyWhereLike{}
- business = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.queryBasicLike(likeMap, business)
- ctx.Convey("Then err should be nil.likeQuery should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- //ctx.So(likeQuery, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoScroll(t *testing.T) {
- convey.Convey("Scroll", t, func(ctx convey.C) {
- var (
- c = context.Background()
- sp = &model.QueryParams{
- QueryBody: &model.QueryBody{},
- AppIDConf: &model.QueryConfDetail{
- ESCluster: "",
- },
- }
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- //res, debug, err :=
- d.Scroll(c, sp)
- ctx.Convey("Then err should be nil.res,debug should not be nil.", func(ctx convey.C) {
- //ctx.So(err, convey.ShouldBeNil)
- //ctx.So(debug, convey.ShouldNotBeNil)
- //ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
|