Skip to content

Commit

Permalink
fix:zverank return error
Browse files Browse the repository at this point in the history
  • Loading branch information
brother-jin committed Jun 27, 2024
1 parent 7e76bb0 commit c0851f9
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tests/integration/zset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1807,19 +1807,11 @@ var _ = Describe("Zset Commands", func() {

rank, err := client.ZRank(ctx, "key", "a1b2C3d4E5").Result()
Expect(err).To(Equal(redis.Nil))
Expect(rank).To(Equal(int64(0))) // Not actually checked since err is redis.Nil
Expect(rank).To(Equal(int64(0)))

revrank, err := client.ZRevRank(ctx, "key", "a1b2C3d4E5").Result()
Expect(err).To(Equal(redis.Nil))
Expect(revrank).To(Equal(int64(0))) // Not actually checked since err is redis.Nil

// Add the correct member to test ZRevRank properly
err = client.ZAdd(ctx, "key", redis.Z{Score: 100, Member: "a1b2C3d4E5"}).Err()
Expect(err).NotTo(HaveOccurred())

revrank, err = client.ZRevRank(ctx, "key", "a1b2C3d4E5").Result()
Expect(err).NotTo(HaveOccurred())
Expect(revrank).To(Equal(int64(1)))
Expect(revrank).To(Equal(int64(0)))

scanResult, cursor, err := client.ZScan(ctx, "key", 0, "", 10).Result()
Expect(err).NotTo(HaveOccurred())
Expand All @@ -1828,7 +1820,7 @@ var _ = Describe("Zset Commands", func() {

card, err := client.ZCard(ctx, "key").Result()
Expect(err).NotTo(HaveOccurred())
Expect(card).To(Equal(int64(2))) // After adding a1b2C3d4E5 back, the count should be 2
Expect(card).To(Equal(int64(1)))
})

//It("should ZRandMember", func() {
Expand Down

0 comments on commit c0851f9

Please sign in to comment.