add redis tests

This commit is contained in:
Michael C
2021-12-19 02:03:50 -05:00
parent caf94a7a93
commit 68bc6469ce
6 changed files with 35 additions and 1 deletions

21
test/cases/redisTest.ts Normal file
View File

@@ -0,0 +1,21 @@
import { config } from "../../src/config";
import redis from "../../src/utils/redis";
import crypto from "crypto";
import assert from "assert";
const randomID = crypto.pseudoRandomBytes(8).toString("hex");
describe("redis test", function() {
before(async function() {
if (!config.redis) this.skip();
await redis.setAsync(randomID, "test");
});
it("Should get stored value", (done) => {
redis.getAsync(randomID)
.then(res => {
if (res.err) assert.fail(res.err);
assert.strictEqual(res.reply, "test");
done();
});
});
});