Closed rg185253 closed 2 years ago
hdel does not delete the key. Here is a test which shows the defect. See that the length does not change to 0, but stays at 1.
import * as redis from "redis-mock";
function checkLength(redisClient, hash) : Promise{ return new Promise((resolve, reject) => { redisClient.hlen(hash, (error, result) => { if (error) { reject(new Error(error)); } resolve(result); }); }); }
describe("hdelTest", () => {
var redisClient; const hash = "myHash"; const key = "myKey"; const value = "myValue"; beforeEach(function () { redisClient = redis.createClient(); }); it("hdel should work", async (done) => { redisClient.hset(hash, key, value); let len = await checkLength(redisClient, hash); expect(len).toBe(1); redisClient.hdel(hash, key); len = await checkLength(redisClient, hash); expect(len).toBe(0); done(); });
});
hdel does not delete the key. Here is a test which shows the defect. See that the length does not change to 0, but stays at 1.
import * as redis from "redis-mock";
function checkLength(redisClient, hash) : Promise{
return new Promise((resolve, reject) => {
redisClient.hlen(hash, (error, result) => {
if (error) {
reject(new Error(error));
}
resolve(result);
});
});
}
describe("hdelTest", () => {
});