search_test.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package search
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-interface/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. s *Service
  13. )
  14. func init() {
  15. dir, _ := filepath.Abs("../cmd/app-interface-test.toml")
  16. flag.Set("conf", dir)
  17. conf.Init()
  18. s = New(conf.Conf)
  19. time.Sleep(time.Second)
  20. }
  21. func WithService(f func(s *Service)) func() {
  22. return func() {
  23. f(s)
  24. }
  25. }
  26. func Test_Search(t *testing.T) {
  27. Convey("get app banner", t, WithService(func(s *Service) {
  28. _, err := s.Search(context.Background(), 1, 2, "", "", "", "", "", "", "", "", "", "", "", "", 3, 4, 5, 6, 7, 8, 1, false, time.Now())
  29. So(err, ShouldBeNil)
  30. }))
  31. }
  32. func Test_SearchByType(t *testing.T) {
  33. Convey("get app banner", t, WithService(func(s *Service) {
  34. _, err := s.SearchByType(context.Background(), 1, 2, "", "", "", "", "", "", "", "", 3, 4, 5, 6, 7, 8, 8, 8, false, time.Now())
  35. So(err, ShouldBeNil)
  36. }))
  37. }
  38. func Test_SearchLive(t *testing.T) {
  39. Convey("get app SearchLive", t, WithService(func(s *Service) {
  40. _, err := s.SearchLive(context.Background(), 1, "", "", "", "", "", "", "", 3, 4, 5)
  41. So(err, ShouldBeNil)
  42. }))
  43. }
  44. func Test_upper(t *testing.T) {
  45. Convey("get app upper", t, WithService(func(s *Service) {
  46. _, err := s.upper(context.Background(), 1, "", "", "", "", "", "", "", 3, 4, 5, 3, 4, 5, 7, false, time.Now())
  47. So(err, ShouldBeNil)
  48. }))
  49. }