mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 06:27:10 +03:00
add redis tests
This commit is contained in:
21
test/cases/redisTest.ts
Normal file
21
test/cases/redisTest.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user