-
Notifications
You must be signed in to change notification settings - Fork 10
/
georadius.test.ts
30 lines (24 loc) · 1.08 KB
/
georadius.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
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/georadius.md example 1", async () => {
const outputs: Record<string, unknown> = {};
outputs.r0 = await client.geoadd("Sicily", [13.361389, 38.115556, "Palermo"], [15.087269, 37.502669, "Catania"]);
outputs.r1 = await client.georadius("Sicily", 15, 37, 200, "km", "WITHDIST");
outputs.r2 = await client.georadius("Sicily", 15, 37, 200, "km", "WITHCOORD");
outputs.r3 = await client.georadius("Sicily", 15, 37, 200, "km", "WITHCOORD", "WITHDIST");
expect(fuzzify(outputs, __filename)).toMatchInlineSnapshot(`
Object {
"r0": 2,
"r1": "ignoreDecimals => Palermo,190.??,Catania,56.??",
"r2": "ignoreDecimals => Palermo,13.??,38.??,Catania,15.??,37.??",
"r3": "ignoreDecimals => Palermo,190.??,13.??,38.??,Catania,56.??,15.??,37.??",
}
`);
});