memcache_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package stat
  2. import (
  3. "context"
  4. "testing"
  5. favmdl "go-common/app/service/main/favorite/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestStatfolderStatMcKey(t *testing.T) {
  9. convey.Convey("folderStatMcKey", t, func(convCtx convey.C) {
  10. var (
  11. table = ""
  12. fid = int64(111)
  13. )
  14. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  15. p1 := folderStatMcKey(table, fid)
  16. convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
  17. convCtx.So(p1, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestStatSetFolderStatMc(t *testing.T) {
  23. convey.Convey("SetFolderStatMc", t, func(convCtx convey.C) {
  24. var (
  25. c = context.Background()
  26. id = int64(111)
  27. s = &favmdl.Folder{}
  28. )
  29. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  30. err := d.SetFolderStatMc(c, id, s)
  31. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  32. convCtx.So(err, convey.ShouldBeNil)
  33. })
  34. })
  35. })
  36. }
  37. func TestStatFolderStatMc(t *testing.T) {
  38. convey.Convey("FolderStatMc", t, func(convCtx convey.C) {
  39. var (
  40. c = context.Background()
  41. id = int64(111)
  42. )
  43. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  44. f, err := d.FolderStatMc(c, id)
  45. convCtx.Convey("Then err should be nil.f should not be nil.", func(convCtx convey.C) {
  46. convCtx.So(err, convey.ShouldBeNil)
  47. convCtx.So(f, convey.ShouldNotBeNil)
  48. })
  49. })
  50. })
  51. }