main_vip_test.go 1018 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package dao
  2. import (
  3. "context"
  4. "github.com/smartystreets/goconvey/convey"
  5. "math/rand"
  6. "strconv"
  7. "testing"
  8. )
  9. func TestDaoMainVip(t *testing.T) {
  10. convey.Convey("MainVip", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. mid = int64(27515308)
  14. )
  15. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  16. mv, err := d.MainVip(c, mid)
  17. ctx.Convey("Then err should be nil.mv should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(mv, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoGiveMVipGift(t *testing.T) {
  25. convey.Convey("GiveMVipGift", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. mid = int64(27515308)
  29. batchId = int(21)
  30. orderNo = "1" + strconv.Itoa(rand.Int()/100000)
  31. )
  32. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  33. err := d.GiveMVipGift(c, mid, batchId, orderNo)
  34. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  35. ctx.So(err, convey.ShouldBeNil)
  36. })
  37. })
  38. })
  39. }