Skip to content

Commit

Permalink
hvals decoder options updated (valkey-io#2216)
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Kumar <[email protected]>
  • Loading branch information
prateek-kumar-improving authored Sep 3, 2024
1 parent 68b40ed commit 6adc0a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
7 changes: 3 additions & 4 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1941,8 +1941,7 @@ export class BaseClient {
* @see {@link https://valkey.io/commands/hvals/|valkey.io} for more details.
*
* @param key - The key of the hash.
* @param decoder - (Optional) {@link Decoder} type which defines how to handle the response.
* If not set, the {@link BaseClientConfiguration.defaultDecoder|default decoder} will be used.
* @param options - (Optional) See {@link DecoderOption}.
* @returns a list of values in the hash, or an empty list when the key does not exist.
*
* @example
Expand All @@ -1954,9 +1953,9 @@ export class BaseClient {
*/
public async hvals(
key: GlideString,
decoder?: Decoder,
options?: DecoderOption,
): Promise<GlideString[]> {
return this.createWritePromise(createHVals(key), { decoder: decoder });
return this.createWritePromise(createHVals(key), options);
}

/**
Expand Down
13 changes: 6 additions & 7 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1922,14 +1922,13 @@ export function runBaseTests(config: {

//hvals with binary buffers
expect(await client.hset(key2, fieldValueMap)).toEqual(2);
expect(await client.hvals(key2, Decoder.Bytes)).toEqual([
value1Encoded,
value2Encoded,
]);
expect(
await client.hvals(key2, { decoder: Decoder.Bytes }),
).toEqual([value1Encoded, value2Encoded]);
expect(await client.hdel(key2, [field1])).toEqual(1);
expect(await client.hvals(key2, Decoder.Bytes)).toEqual([
value2Encoded,
]);
expect(
await client.hvals(key2, { decoder: Decoder.Bytes }),
).toEqual([value2Encoded]);
}, protocol);
},
config.timeout,
Expand Down

0 comments on commit 6adc0a2

Please sign in to comment.