dao_test.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/service/main/search/conf"
  8. "go-common/app/service/main/search/model"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. func WithDao(f func(d *Dao)) func() {
  12. return func() {
  13. dir, _ := filepath.Abs("../cmd/goconvey.toml")
  14. flag.Set("conf", dir)
  15. flag.Parse()
  16. conf.Init()
  17. d := New(conf.Conf)
  18. f(d)
  19. }
  20. }
  21. func Test_PgcMedia(t *testing.T) {
  22. Convey("open app", t, WithDao(func(d *Dao) {
  23. var (
  24. err error
  25. c = context.TODO()
  26. p *model.PgcMediaParams
  27. )
  28. _, err = d.PgcMedia(c, p)
  29. So(err, ShouldBeNil)
  30. }))
  31. }
  32. func Test_ReplyRecord(t *testing.T) {
  33. Convey("reply record", t, WithDao(func(d *Dao) {
  34. var (
  35. err error
  36. c = context.TODO()
  37. p *model.ReplyRecordParams
  38. )
  39. _, err = d.ReplyRecord(c, p)
  40. So(err, ShouldBeNil)
  41. }))
  42. }
  43. func Test_DmHistory(t *testing.T) {
  44. Convey("DmHistory", t, WithDao(func(d *Dao) {
  45. var (
  46. err error
  47. c = context.TODO()
  48. p *model.DmHistoryParams
  49. )
  50. _, err = d.DmHistory(c, p)
  51. So(err, ShouldBeNil)
  52. }))
  53. }