wild_test.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package search
  2. import (
  3. "context"
  4. "testing"
  5. mdlSearch "go-common/app/interface/main/tv/model/search"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_UserSearch(t *testing.T) {
  9. Convey("test user search", t, WithService(func(s *Service) {
  10. arg := &mdlSearch.UserSearch{
  11. Keyword: "lex",
  12. Build: "111",
  13. SearchType: "all",
  14. Page: 1,
  15. Pagesize: 20,
  16. }
  17. res, err := s.UserSearch(context.Background(), arg)
  18. So(err, ShouldBeNil)
  19. So(len(res), ShouldNotBeEmpty)
  20. }))
  21. }
  22. func TestService_SearchAll(t *testing.T) {
  23. Convey("test search all", t, WithService(func(s *Service) {
  24. arg := &mdlSearch.UserSearch{
  25. Keyword: "工作细胞",
  26. Build: "111",
  27. SearchType: "bili_user",
  28. Page: 1,
  29. Pagesize: 20,
  30. }
  31. res, err := s.SearchAll(context.Background(), arg)
  32. So(err, ShouldBeNil)
  33. So(res, ShouldNotBeEmpty)
  34. }))
  35. }
  36. func TestService_PgcSearch(t *testing.T) {
  37. Convey("test pgc search", t, WithService(func(s *Service) {
  38. arg := &mdlSearch.UserSearch{
  39. Keyword: "工作细胞",
  40. Build: "111",
  41. SearchType: "all",
  42. Page: 1,
  43. Pagesize: 20,
  44. }
  45. res, err := s.PgcSearch(context.Background(), arg)
  46. So(err, ShouldBeNil)
  47. So(res, ShouldNotBeEmpty)
  48. }))
  49. }