-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpexpire.test.ts
36 lines (30 loc) · 1.19 KB
/
pexpire.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { createNodeRedisClient } from "../../../src";
import { fuzzify } from "../../fuzzify";
const client = createNodeRedisClient();
beforeAll(async () => {
await client.ping();
});
beforeEach(async () => {
await client.flushall();
});
test("docs/redis-doc/commands/pexpire.md example 1", async () => {
const outputs: Record<string, unknown> = {};
outputs.r0 = await client.set("mykey", "Hello");
outputs.r1 = await client.pexpire("mykey", 1500);
outputs.r2 = await client.ttl("mykey");
outputs.r3 = await client.pttl("mykey");
// "XX","NX" not supported in redis v6! outputs.r4 = await client.pexpire("mykey",1000,"XX")
outputs.r5 = await client.ttl("mykey");
// "XX","NX" not supported in redis v6! outputs.r6 = await client.pexpire("mykey",1000,"NX")
outputs.r7 = await client.ttl("mykey");
expect(fuzzify(outputs, __filename)).toMatchInlineSnapshot(`
Object {
"r0": "OK",
"r1": "someNumberValue => [a number]",
"r2": "someNumberValue => [a number]",
"r3": "someNumberValue => [a number]",
"r5": "someNumberValue => [a number]",
"r7": "someNumberValue => [a number]",
}
`);
});