ut_app_test.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoSetAppCovCache(t *testing.T) {
  8. convey.Convey("SetAppCovCache", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  13. err := d.SetAppCovCache(c)
  14. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. // coverage, _ := d.GetAppCovCache(c, "main")
  17. // t.Logf("\nthe coverage is %.2f\n", coverage)
  18. })
  19. })
  20. })
  21. }
  22. func TestDaoGetAppCovCache(t *testing.T) {
  23. convey.Convey("GetAppCovCache", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. path = "main"
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. coverage, err := d.GetAppCovCache(c, path)
  30. ctx.Convey("Then err should be nil.coverage should not be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. ctx.So(coverage, convey.ShouldNotBeNil)
  33. t.Logf("\nthe coverage is %.2f\n", coverage)
  34. })
  35. })
  36. })
  37. }