Skip to content

Commit 925b917

Browse files
committed
Added a test case in HashOperationsSpec for deleting multiple keys in a hash
1 parent 29947c5 commit 925b917

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/scala/com/redis/HashOperationsSpec.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ class HashOperationsSpec extends FunSpec
9191
val thrown = the [Exception] thrownBy { r.hincrbyfloat("hash1", "field1", 2.0e2f) }
9292
thrown.getMessage should include("hash value is not a valid float")
9393
}
94+
95+
it("should delete multiple keys if present on a hash") {
96+
r.hset("hash100", "key1", 10.20f)
97+
r.hset("hash100", "key2", 10.30f)
98+
r.hset("hash100", "key3", 10.40f)
99+
r.hset("hash100", "key4", 10.50f)
100+
r.hset("hash100", "key5", 10.60f)
101+
r.hkeys("hash100") should be(Some(List("key1", "key2", "key3", "key4", "key5")))
102+
r.hdel("hash100", "key1", "key2", "key3", "key4", "key5") should equal(Some(5))
103+
r.hkeys("hash100") should be(Some(List()))
104+
}
94105
}
95106

96107
describe("hset1") {

0 commit comments

Comments
 (0)