version_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package version
  2. import (
  3. "context"
  4. "flag"
  5. "go-common/app/interface/main/app-resource/conf"
  6. "path/filepath"
  7. "testing"
  8. "time"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func TestAll(t *testing.T) {
  15. Convey("get all", t, func() {
  16. res, err := d.All(ctx())
  17. So(err, ShouldBeNil)
  18. So(res, ShouldNotBeEmpty)
  19. })
  20. }
  21. func TestUpdates(t *testing.T) {
  22. Convey("get Updates all", t, func() {
  23. res, err := d.Updates(ctx())
  24. So(err, ShouldBeNil)
  25. So(res, ShouldNotBeEmpty)
  26. })
  27. }
  28. func TestIncrementals(t *testing.T) {
  29. Convey("get Incrementals all", t, func() {
  30. res, err := d.Incrementals(ctx())
  31. So(err, ShouldBeNil)
  32. So(res, ShouldNotBeEmpty)
  33. })
  34. }
  35. func TestSos(t *testing.T) {
  36. Convey("get Sos all", t, func() {
  37. res, err := d.Sos(ctx())
  38. So(err, ShouldBeNil)
  39. So(res, ShouldNotBeEmpty)
  40. })
  41. }
  42. func TestRn(t *testing.T) {
  43. Convey("get Rn all", t, func() {
  44. res, err := d.Rn(ctx())
  45. So(err, ShouldBeNil)
  46. So(res, ShouldNotBeEmpty)
  47. })
  48. }
  49. func ctx() context.Context {
  50. return context.Background()
  51. }
  52. func init() {
  53. dir, _ := filepath.Abs("../../cmd/app-resource-test.toml")
  54. flag.Set("conf", dir)
  55. conf.Init()
  56. d = New(conf.Conf)
  57. time.Sleep(time.Second)
  58. }