Skip to content

Commit

Permalink
add hincrby cmd test
Browse files Browse the repository at this point in the history
  • Loading branch information
QlQlqiqi committed Jul 31, 2024
1 parent ee3d1f5 commit e60aa6e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/hash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,27 @@ var _ = Describe("Hash", Ordered, func() {
Expect(length.Val()).To(Equal(int64(len("hello1"))))
})

It("should HIncrBy against wrong metadata", func() {
hSet := client.HSet(ctx, "hash", "key", "5")
Expect(hSet.Err()).NotTo(HaveOccurred())

hIncrBy := client.HIncrBy(ctx, "hash", "key", 1)
Expect(hIncrBy.Err()).NotTo(HaveOccurred())
Expect(hIncrBy.Val()).To(Equal(int64(6)))

hDel := client.HDel(ctx, "hash", "key")
Expect(hDel.Err()).NotTo(HaveOccurred())
Expect(hDel.Val()).To(Equal(int64(1)))

hIncrBy = client.HIncrBy(ctx, "hash", "key", 1)
Expect(hIncrBy.Err()).NotTo(HaveOccurred())
Expect(hIncrBy.Val()).To(Equal(int64(1)))

hIncrBy = client.HIncrBy(ctx, "hash", "key", 2)
Expect(hIncrBy.Err()).NotTo(HaveOccurred())
Expect(hIncrBy.Val()).To(Equal(int64(3)))
})

It("HIncrbyFloat", func() {
hSet := client.HSet(ctx, "hash", "field", "10.50")
Expect(hSet.Err()).NotTo(HaveOccurred())
Expand Down

0 comments on commit e60aa6e

Please sign in to comment.