mc_test.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package anchorReward
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestAnchorRewardpingMC(t *testing.T) {
  8. convey.Convey("pingMC", 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.pingMC(c)
  14. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestAnchorRewardnewRewardKey(t *testing.T) {
  21. convey.Convey("newRewardKey", t, func(ctx convey.C) {
  22. var (
  23. uid = int64(0)
  24. )
  25. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  26. p1 := newRewardKey(uid)
  27. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  28. ctx.So(p1, convey.ShouldNotBeNil)
  29. })
  30. })
  31. })
  32. }
  33. func TestAnchorRewardSetNewReward(t *testing.T) {
  34. convey.Convey("SetNewReward", t, func(ctx convey.C) {
  35. var (
  36. c = context.Background()
  37. uid = int64(0)
  38. hasNew = int64(0)
  39. )
  40. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  41. err := d.SetNewReward(c, uid, hasNew)
  42. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestAnchorRewardGetNewReward(t *testing.T) {
  49. convey.Convey("GetNewReward", t, func(ctx convey.C) {
  50. var (
  51. c = context.Background()
  52. uid = int64(0)
  53. )
  54. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  55. r, err := d.GetNewReward(c, uid)
  56. ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
  57. ctx.So(err, convey.ShouldBeNil)
  58. ctx.So(r, convey.ShouldNotBeNil)
  59. })
  60. })
  61. })
  62. }
  63. func TestAnchorRewardGetHasReward(t *testing.T) {
  64. convey.Convey("GetHasReward", t, func(ctx convey.C) {
  65. var (
  66. c = context.Background()
  67. uid = int64(0)
  68. )
  69. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  70. r, err := d.GetHasReward(c, uid)
  71. ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
  72. ctx.So(err, convey.ShouldBeNil)
  73. ctx.So(r, convey.ShouldNotBeNil)
  74. })
  75. })
  76. })
  77. }
  78. func TestAnchorRewardhasRewardKey(t *testing.T) {
  79. convey.Convey("hasRewardKey", t, func(ctx convey.C) {
  80. var (
  81. uid = int64(0)
  82. )
  83. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  84. p1 := hasRewardKey(uid)
  85. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  86. ctx.So(p1, convey.ShouldNotBeNil)
  87. })
  88. })
  89. })
  90. }
  91. func TestAnchorRewardSetHasReward(t *testing.T) {
  92. convey.Convey("SetHasReward", t, func(ctx convey.C) {
  93. var (
  94. c = context.Background()
  95. uid = int64(0)
  96. isHave = int64(0)
  97. )
  98. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  99. err := d.SetHasReward(c, uid, isHave)
  100. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  101. ctx.So(err, convey.ShouldBeNil)
  102. })
  103. })
  104. })
  105. }
  106. func TestAnchorRewardGetOrder(t *testing.T) {
  107. convey.Convey("GetOrder", t, func(ctx convey.C) {
  108. var (
  109. c = context.Background()
  110. id = ""
  111. )
  112. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  113. exists, err := d.GetOrder(c, id)
  114. ctx.Convey("Then err should be nil.exists should not be nil.", func(ctx convey.C) {
  115. ctx.So(err, convey.ShouldBeNil)
  116. ctx.So(exists, convey.ShouldNotBeNil)
  117. })
  118. })
  119. })
  120. }
  121. func TestAnchorRewardSaveOrder(t *testing.T) {
  122. convey.Convey("SaveOrder", t, func(ctx convey.C) {
  123. var (
  124. c = context.Background()
  125. id = ""
  126. )
  127. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  128. err := d.SaveOrder(c, id)
  129. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  130. ctx.So(err, convey.ShouldBeNil)
  131. })
  132. })
  133. })
  134. }