dao_test.go 560 B

1234567891011121314151617181920212223242526272829303132333435
  1. package sidebar
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/interface/main/app-interface/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. var d *Dao
  11. func init() {
  12. dir, _ := filepath.Abs("../cmd/app-interface-test.toml")
  13. flag.Set("conf", dir)
  14. conf.Init()
  15. d = New(conf.Conf)
  16. }
  17. func WithDao(f func(d *Dao)) func() {
  18. return func() {
  19. Reset(func() {})
  20. f(d)
  21. }
  22. }
  23. func TestDao_Sidebar(t *testing.T) {
  24. Convey("ArchiveInfo", t, WithDao(func(d *Dao) {
  25. _, err := d.Sidebars(context.TODO())
  26. So(err, ShouldBeNil)
  27. }))
  28. }