Back rate limit by redia and upgrade node-redis

This commit is contained in:
Ajay
2022-04-13 17:36:07 -04:00
parent 41c92da37e
commit 8dc87da462
14 changed files with 292 additions and 158 deletions

View File

@@ -12,21 +12,20 @@ const randKey2 = genRandom(16);
describe("redis test", function() {
before(async function() {
if (!config.redis) this.skip();
await redis.setAsync(randKey1, randValue1);
await redis.set(randKey1, randValue1);
});
it("Should get stored value", (done) => {
redis.getAsync(randKey1)
redis.get(randKey1)
.then(res => {
if (res.err) assert.fail(res.err);
assert.strictEqual(res.reply, randValue1);
assert.strictEqual(res, randValue1);
done();
});
}).catch(err => assert.fail(err));
});
it("Should not be able to get not stored value", (done) => {
redis.getAsync(randKey2)
redis.get(randKey2)
.then(res => {
if (res.reply || res.err ) assert.fail("Value should not be found");
if (res) assert.fail("Value should not be found");
done();
});
}).catch(err => assert.fail(err));
});
});