1
0
mirror of https://github.com/redis/node-redis.git synced 2025-12-12 21:21:15 +03:00

feat(client): add CAS/CAD, DELEX, DIGEST support (#3123)

* feat: add digest command and tests

* feat: add delex command and tests

* feat: add more conditional options to SET update tests
This commit is contained in:
Pavel Pashov
2025-11-03 13:53:01 +02:00
committed by GitHub
parent 5a0a06df69
commit 2fdb6def45
7 changed files with 244 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
import { strict as assert } from "node:assert";
import DIGEST from "./DIGEST";
import { parseArgs } from "./generic-transformers";
import testUtils, { GLOBAL } from "../test-utils";
describe("DIGEST", () => {
describe("transformArguments", () => {
it("digest", () => {
assert.deepEqual(parseArgs(DIGEST, "key"), ["DIGEST", "key"]);
});
});
testUtils.testAll(
"existing key",
async (client) => {
await client.set("key{tag}", "value");
assert.equal(typeof await client.digest("key{tag}"), "string");
},
{
client: { ...GLOBAL.SERVERS.OPEN, minimumDockerVersion: [8, 4] },
cluster: { ...GLOBAL.CLUSTERS.OPEN, minimumDockerVersion: [8, 4] },
}
);
testUtils.testAll(
"non-existing key",
async (client) => {
assert.equal(await client.digest("key{tag}"), null);
},
{
client: { ...GLOBAL.SERVERS.OPEN, minimumDockerVersion: [8, 4] },
cluster: { ...GLOBAL.CLUSTERS.OPEN, minimumDockerVersion: [8, 4] },
}
);
});