service_test.go 763 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/job/main/workflow/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func WithService(f func(s *Service)) func() {
  11. return func() {
  12. dir, _ := filepath.Abs("../goconvey.toml")
  13. flag.Set("conf", dir)
  14. conf.Init()
  15. s := New(conf.Conf)
  16. f(s)
  17. }
  18. }
  19. func Test_queueproc(t *testing.T) {
  20. var (
  21. c = context.TODO()
  22. dealType = 1
  23. )
  24. Convey("queueproc", t, WithService(func(s *Service) {
  25. s.queueproc(c, dealType)
  26. So(nil, ShouldBeNil)
  27. }))
  28. }
  29. func Test_taskExpireproc(t *testing.T) {
  30. var (
  31. c = context.TODO()
  32. dealType = 1
  33. )
  34. Convey("taskExpireproc", t, WithService(func(s *Service) {
  35. s.taskExpireproc(c, dealType)
  36. So(nil, ShouldBeNil)
  37. }))
  38. }