redis_test.go 556 B

123456789101112131415161718192021222324252627282930
  1. package push
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDao_ZrangeList(t *testing.T) {
  8. Convey("TestDao_ZrangeList", t, WithDao(func(d *Dao) {
  9. data, err := d.ZrangeList(context.TODO())
  10. So(err, ShouldBeNil)
  11. So(data, ShouldNotBeNil)
  12. Printf("%+v", data)
  13. }))
  14. }
  15. func TestDao_ZRem(t *testing.T) {
  16. var (
  17. conn = d.redis.Get(ctx)
  18. key = _pushKey
  19. id = "999"
  20. )
  21. Convey("everything is fine", t, WithDao(func(d *Dao) {
  22. conn.Do("ZADD", key, id)
  23. err := d.ZRem(ctx, id)
  24. So(err, ShouldBeNil)
  25. }))
  26. }