service_test.go 659 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/job/main/archive/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. var (
  11. s *Service
  12. )
  13. func init() {
  14. dir, _ := filepath.Abs("../cmd/archive-job-test.toml")
  15. flag.Set("conf", dir)
  16. conf.Init()
  17. s = New(conf.Conf)
  18. }
  19. func Test_loadType(t *testing.T) {
  20. Convey("loadType", t, func() {
  21. s.loadType()
  22. })
  23. }
  24. func Test_PopFail(t *testing.T) {
  25. Convey("PopFail", t, func() {
  26. s.PopFail(context.TODO())
  27. })
  28. }
  29. func Test_TranResult(t *testing.T) {
  30. Convey("tranResult", t, func() {
  31. _, _, _, err := s.tranResult(context.TODO(), 10098500)
  32. So(err, ShouldBeNil)
  33. })
  34. }