memcached_test.go 995 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/thumbup/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaostatsKey(t *testing.T) {
  9. convey.Convey("statsKey", t, func(convCtx convey.C) {
  10. var (
  11. businessID = int64(33)
  12. messageID = int64(2233)
  13. )
  14. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  15. p1 := statsKey(businessID, messageID)
  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 TestDaoAddStatsCache(t *testing.T) {
  23. convey.Convey("AddStatsCache", t, func(convCtx convey.C) {
  24. var (
  25. c = context.Background()
  26. businessID = int64(33)
  27. ms = &model.Stats{}
  28. )
  29. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  30. err := d.AddStatsCache(c, businessID, ms)
  31. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  32. convCtx.So(err, convey.ShouldBeNil)
  33. })
  34. })
  35. })
  36. }