memcache_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package recommend
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/app-card/model/card/ai"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestAddRcmdAidsCache(t *testing.T) {
  9. var (
  10. c = context.TODO()
  11. aids = []int64{1}
  12. )
  13. convey.Convey("Ping", t, func(ctx convey.C) {
  14. err := d.AddRcmdAidsCache(c, aids)
  15. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldNotBeNil)
  17. })
  18. })
  19. }
  20. func TestRcmdAidsCache(t *testing.T) {
  21. var (
  22. c = context.TODO()
  23. )
  24. convey.Convey("Ping", t, func(ctx convey.C) {
  25. _, err := d.RcmdAidsCache(c)
  26. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  27. ctx.So(err, convey.ShouldNotBeNil)
  28. })
  29. })
  30. }
  31. func TestAddRcmdCache(t *testing.T) {
  32. var (
  33. c = context.TODO()
  34. is = []*ai.Item{}
  35. )
  36. convey.Convey("Ping", t, func(ctx convey.C) {
  37. err := d.AddRcmdCache(c, is)
  38. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  39. ctx.So(err, convey.ShouldNotBeNil)
  40. })
  41. })
  42. }
  43. func TestRcmdCache(t *testing.T) {
  44. var (
  45. c = context.TODO()
  46. )
  47. convey.Convey("Ping", t, func(ctx convey.C) {
  48. _, err := d.RcmdCache(c)
  49. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  50. ctx.So(err, convey.ShouldNotBeNil)
  51. })
  52. })
  53. }