mysql_test.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/service/main/card/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoRawEquip(t *testing.T) {
  9. convey.Convey("RawEquip", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. mid = int64(2)
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. r, err := d.RawEquip(c, mid)
  16. ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(r, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoRawEquips(t *testing.T) {
  24. convey.Convey("RawEquips", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. mids = []int64{1, 2, 3}
  28. )
  29. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  30. res, err := d.RawEquips(c, mids)
  31. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldBeNil)
  33. ctx.So(res, convey.ShouldNotBeNil)
  34. })
  35. })
  36. })
  37. }
  38. func TestDaoEffectiveCards(t *testing.T) {
  39. convey.Convey("EffectiveCards", t, func(ctx convey.C) {
  40. var (
  41. c = context.Background()
  42. )
  43. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  44. res, err := d.EffectiveCards(c)
  45. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. ctx.So(res, convey.ShouldNotBeNil)
  48. })
  49. })
  50. })
  51. }
  52. func TestDaoEffectiveGroups(t *testing.T) {
  53. convey.Convey("EffectiveGroups", t, func(ctx convey.C) {
  54. var (
  55. c = context.Background()
  56. )
  57. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  58. res, err := d.EffectiveGroups(c)
  59. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  60. ctx.So(err, convey.ShouldBeNil)
  61. ctx.So(res, convey.ShouldNotBeNil)
  62. })
  63. })
  64. })
  65. }
  66. func TestDaoCardEquip(t *testing.T) {
  67. convey.Convey("CardEquip", t, func(ctx convey.C) {
  68. var (
  69. c = context.Background()
  70. e = &model.UserEquip{}
  71. )
  72. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  73. err := d.CardEquip(c, e)
  74. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  75. ctx.So(err, convey.ShouldBeNil)
  76. })
  77. })
  78. })
  79. }
  80. func TestDaoDeleteEquip(t *testing.T) {
  81. convey.Convey("DeleteEquip", t, func(ctx convey.C) {
  82. var (
  83. c = context.Background()
  84. mid = int64(0)
  85. )
  86. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  87. err := d.DeleteEquip(c, mid)
  88. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  89. ctx.So(err, convey.ShouldBeNil)
  90. })
  91. })
  92. })
  93. }