Create & Init Project...
This commit is contained in:
37
app/interface/main/app-resource/service/white/white_test.go
Normal file
37
app/interface/main/app-resource/service/white/white_test.go
Normal file
@ -0,0 +1,37 @@
|
||||
package white
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"go-common/app/interface/main/app-resource/conf"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
var (
|
||||
s *Service
|
||||
)
|
||||
|
||||
func WithService(f func(s *Service)) func() {
|
||||
return func() {
|
||||
f(s)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
dir, _ := filepath.Abs("../../cmd/app-resource-test.toml")
|
||||
flag.Set("conf", dir)
|
||||
conf.Init()
|
||||
s = New(conf.Conf)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
Convey("get List data", t, WithService(func(s *Service) {
|
||||
res := s.List()
|
||||
So(res, ShouldNotBeEmpty)
|
||||
}))
|
||||
}
|
Reference in New Issue
Block a user