redis_test.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package bplus
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/app-interface/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. // TestKeyContributeAttr dao ut.
  9. func TestKeyContributeAttr(t *testing.T) {
  10. Convey("keyContributeAttr", t, func(ctx C) {
  11. key := keyContributeAttr(int64(123456))
  12. ctx.Convey("key should not be equal to 123456", func(ctx C) {
  13. ctx.So(key, ShouldEqual, "cba_123456")
  14. })
  15. })
  16. }
  17. // TestKeyContribute dao ut.
  18. func TestKeyContribute(t *testing.T) {
  19. Convey("keyContribute", t, func(ctx C) {
  20. key := keyContribute(int64(123456))
  21. ctx.Convey("key should not be equal to 123456", func(ctx C) {
  22. ctx.So(key, ShouldEqual, "cb_123456")
  23. })
  24. })
  25. }
  26. // TestRangeContributeCache dao ut.
  27. func TestRangeContributeCache(t *testing.T) {
  28. Convey("RangeContributeCache", t, func(ctx C) {
  29. _, err := dao.RangeContributeCache(context.Background(), 123456, 1, 20)
  30. ctx.Convey("Then err should not be nil.", func(ctx C) {
  31. ctx.So(err, ShouldNotBeNil)
  32. })
  33. })
  34. }
  35. // TestRangeContributionCache dao ut.
  36. func TestRangeContributionCache(t *testing.T) {
  37. Convey("RangeContributionCache", t, func(ctx C) {
  38. var cursor = &model.Cursor{}
  39. _, err := dao.RangeContributionCache(context.Background(), 123456, cursor)
  40. ctx.Convey("Then err should not be nil.", func(ctx C) {
  41. ctx.So(err, ShouldNotBeNil)
  42. })
  43. })
  44. }