go-common/app/admin/main/activity/service/service_test.go

37 lines
559 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"flag"
"path/filepath"
"testing"
"time"
"go-common/app/admin/main/activity/conf"
. "github.com/smartystreets/goconvey/convey"
)
var svr *Service
func init() {
dir, _ := filepath.Abs("../cmd/activity-admin-test.toml")
flag.Set("conf", dir)
conf.Init()
svr = New(conf.Conf)
time.Sleep(time.Second)
}
func WithService(f func(s *Service)) func() {
return func() {
Reset(func() {})
f(svr)
}
}
func Test_Service(t *testing.T) {
Convey("service test", t, WithService(func(s *Service) {
s.Wait()
s.Close()
}))
}