-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathlrange.test.ts
46 lines (40 loc) · 1.16 KB
/
lrange.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
37
38
39
40
41
42
43
44
45
46
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/lrange.md example 1", async () => {
const outputs: Record<string, unknown> = {};
outputs.r0 = await client.rpush("mylist", "one");
outputs.r1 = await client.rpush("mylist", "two");
outputs.r2 = await client.rpush("mylist", "three");
outputs.r3 = await client.lrange("mylist", 0, 0);
outputs.r4 = await client.lrange("mylist", -3, 2);
outputs.r5 = await client.lrange("mylist", -100, 100);
outputs.r6 = await client.lrange("mylist", 5, 10);
expect(fuzzify(outputs, __filename)).toMatchInlineSnapshot(`
Object {
"r0": 1,
"r1": 2,
"r2": 3,
"r3": Array [
"one",
],
"r4": Array [
"one",
"two",
"three",
],
"r5": Array [
"one",
"two",
"three",
],
"r6": Array [],
}
`);
});