mc.cache_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package bnj
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestBnjAddCacheTimeFinish(t *testing.T) {
  8. convey.Convey("AddCacheTimeFinish", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. val = int64(0)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. err := d.AddCacheTimeFinish(c, val)
  15. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestBnjCacheTimeFinish(t *testing.T) {
  22. convey.Convey("CacheTimeFinish", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. )
  26. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  27. res, err := d.CacheTimeFinish(c)
  28. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(res, convey.ShouldNotBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestBnjCacheLessTime(t *testing.T) {
  36. convey.Convey("CacheLessTime", t, func(ctx convey.C) {
  37. var (
  38. c = context.Background()
  39. )
  40. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  41. res, err := d.CacheLessTime(c)
  42. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. ctx.So(res, convey.ShouldNotBeNil)
  45. })
  46. })
  47. })
  48. }
  49. func TestBnjAddCacheLessTime(t *testing.T) {
  50. convey.Convey("AddCacheLessTime", t, func(ctx convey.C) {
  51. var (
  52. c = context.Background()
  53. val = int64(0)
  54. )
  55. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  56. err := d.AddCacheLessTime(c, val)
  57. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldBeNil)
  59. })
  60. })
  61. })
  62. }