mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 12:37:00 +03:00
add arrayDeepPartialEquals
This commit is contained in:
@@ -3,19 +3,30 @@ import redis from "../../src/utils/redis";
|
||||
import crypto from "crypto";
|
||||
import assert from "assert";
|
||||
|
||||
const randomID = crypto.pseudoRandomBytes(8).toString("hex");
|
||||
const genRandom = (bytes=8) => crypto.pseudoRandomBytes(bytes).toString("hex");
|
||||
|
||||
const randKey1 = genRandom();
|
||||
const randValue1 = genRandom();
|
||||
const randKey2 = genRandom(16);
|
||||
|
||||
describe("redis test", function() {
|
||||
before(async function() {
|
||||
if (!config.redis) this.skip();
|
||||
await redis.setAsync(randomID, "test");
|
||||
await redis.setAsync(randKey1, randValue1);
|
||||
});
|
||||
it("Should get stored value", (done) => {
|
||||
redis.getAsync(randomID)
|
||||
redis.getAsync(randKey1)
|
||||
.then(res => {
|
||||
if (res.err) assert.fail(res.err);
|
||||
assert.strictEqual(res.reply, "test");
|
||||
assert.strictEqual(res.reply, randValue1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("Should not be able to get not stored value", (done) => {
|
||||
redis.getAsync(randKey2)
|
||||
.then(res => {
|
||||
if (res.reply || res.err ) assert.fail("Value should not be found")
|
||||
done();
|
||||
});
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user