local_equip_test.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package pendant
  2. import (
  3. "go-common/app/service/main/usersuit/model"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestPendantloadEquip(t *testing.T) {
  8. convey.Convey("loadEquip", t, func(ctx convey.C) {
  9. var (
  10. mid = int64(650454)
  11. info = &model.PendantEquip{}
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. d.AddEquipCache(c, mid, info)
  15. p1, err := d.loadEquip(c, mid)
  16. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(p1, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestPendantstoreEquip(t *testing.T) {
  24. convey.Convey("storeEquip", t, func(ctx convey.C) {
  25. var (
  26. mid = int64(650454)
  27. equip = &model.PendantEquip{}
  28. )
  29. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  30. d.storeEquip(mid, equip)
  31. ctx.Convey("No return values", func(ctx convey.C) {
  32. })
  33. })
  34. })
  35. }
  36. func TestPendantlocalEquip(t *testing.T) {
  37. convey.Convey("localEquip", t, func(ctx convey.C) {
  38. var (
  39. mid = int64(650454)
  40. )
  41. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  42. p1, err := d.localEquip(mid)
  43. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. ctx.So(p1, convey.ShouldNotBeNil)
  46. })
  47. })
  48. })
  49. }
  50. func TestPendantEquipCache(t *testing.T) {
  51. convey.Convey("EquipCache", t, func(ctx convey.C) {
  52. var (
  53. mid = int64(650454)
  54. )
  55. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  56. p1, err := d.EquipCache(c, mid)
  57. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldBeNil)
  59. ctx.So(p1, convey.ShouldNotBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestPendantEquipsCache(t *testing.T) {
  65. convey.Convey("EquipsCache", t, func(ctx convey.C) {
  66. var (
  67. mids = []int64{650454, 1}
  68. info = &model.PendantEquip{}
  69. )
  70. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  71. d.AddEquipCache(c, int64(650454), info)
  72. d.AddEquipCache(c, int64(1), info)
  73. p1, p2, err := d.EquipsCache(c, mids)
  74. ctx.Convey("Then err should be nil.p1,p2 should not be nil.", func(ctx convey.C) {
  75. ctx.So(err, convey.ShouldBeNil)
  76. ctx.So(p2, convey.ShouldNotBeNil)
  77. ctx.So(p1, convey.ShouldNotBeNil)
  78. })
  79. })
  80. })
  81. }