show_test.go 668 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package show
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-resource/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. s *Service
  13. )
  14. func WithService(f func(s *Service)) func() {
  15. return func() {
  16. f(s)
  17. }
  18. }
  19. func init() {
  20. dir, _ := filepath.Abs("../../cmd/app-resource-test.toml")
  21. flag.Set("conf", dir)
  22. conf.Init()
  23. s = New(conf.Conf)
  24. time.Sleep(time.Second)
  25. }
  26. func TestTabs(t *testing.T) {
  27. Convey("get Tabs data", t, WithService(func(s *Service) {
  28. res, _, _, err := s.Tabs(context.TODO(), 1, 1, "xxxx", "xxx", "iphone", "hans", 111)
  29. So(res, ShouldNotBeEmpty)
  30. So(err, ShouldBeNil)
  31. }))
  32. }