From f0eef9dc3accf432ee717cf8f8d6296d3ebcb11e Mon Sep 17 00:00:00 2001 From: TJ Zhang Date: Tue, 23 Jul 2024 12:25:53 -0700 Subject: [PATCH] addressing comments Signed-off-by: TJ Zhang --- node/src/BaseClient.ts | 2 +- node/tests/SharedTests.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/node/src/BaseClient.ts b/node/src/BaseClient.ts index 65742c1b24..669fb4d6a9 100644 --- a/node/src/BaseClient.ts +++ b/node/src/BaseClient.ts @@ -3434,7 +3434,7 @@ export class BaseClient { * ``` */ public geohash(key: string, members: string[]): Promise<(string | null)[]> { - return this.createWritePromise( + return this.createWritePromise<(string | null)[]>( createGeoHash(key, members), ).then((hashes) => hashes.map((hash) => (hash === null ? null : "" + hash)), diff --git a/node/tests/SharedTests.ts b/node/tests/SharedTests.ts index c57b950631..872a95d766 100644 --- a/node/tests/SharedTests.ts +++ b/node/tests/SharedTests.ts @@ -4567,12 +4567,15 @@ export function runBaseTests(config: { new GeospatialData(15.087269, 37.502669), ); expect(await client.geoadd(key1, membersToCoordinates)).toBe(2); + // checking result with default metric expect(await client.geohash(key1, members)).toEqual(expected); + // empty members array expect(await (await client.geohash(key1, empty)).length).toBe( 0, ); + // key exists but holds non-ZSET value expect(await client.set(key2, "geohash")).toBe("OK"); await expect(client.geohash(key2, members)).rejects.toThrow();