Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Jun 12, 2024
1 parent b97dc25 commit 26f96f5
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 24 deletions.
24 changes: 10 additions & 14 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1952,16 +1952,14 @@ export class BaseClient {

/**
* Computes the intersection of sorted sets given by the specified `keys` and returns a list of intersecting elements.
* To get the scores as well, see `zinter_withscores`.
* To store the result in a key as a sorted set, see `zinterstore`.
* To get the scores as well, see `zinterWithScores`.
* To store the result in a key as a sorted set, see `zinterStore`.
*
* When in cluster mode, all keys in `keys` must map to the same hash slot.
*
* See https://valkey.io/commands/zinter/ for more details.
*
* @param keys - The keys of the sorted sets with possible formats:
* string[] - for keys only.
* KeyWeight[] - for weighted keys with score multipliers.
* @param keys - The keys of the sorted sets.
* @returns The resulting array of intersecting elements.
*
* @example
Expand All @@ -1972,7 +1970,7 @@ export class BaseClient {
* ```
*/
public zinter(
keys: string[] | KeyWeight[],
keys: string[],
): Promise<string[]> {
return this.createWritePromise(
createZInter(keys),
Expand All @@ -1982,7 +1980,7 @@ export class BaseClient {
/**
* Computes the intersection of sorted sets given by the specified `keys` and returns a list of intersecting elements with scores.
* To get the elements only, see `zinter`.
* To store the result in a key as a sorted set, see `zinterstore`.
* To store the result in a key as a sorted set, see `zinterStore`.
*
* When in cluster mode, all keys in `keys` must map to the same hash slot.
*
Expand Down Expand Up @@ -2013,17 +2011,15 @@ export class BaseClient {

/**
* Computes the union of sorted sets given by the specified `keys` and returns a list of union elements.
* To get the scores as well, see `zunion_withscores`.
* To get the scores as well, see `zunionWithScores`.
*
* To store the result in a key as a sorted set, see `zunionstore`.
* To store the result in a key as a sorted set, see `zunionStore`.
*
* When in cluster mode, all keys in `keys` must map to the same hash slot.
*
* See https://valkey.io/commands/zunion/ for more details.
*
* @param keys - The keys of the sorted sets with possible formats:
* string[] - for keys only.
* KeyWeight[] - for weighted keys with score multipliers.
* @param keys - The keys of the sorted sets.
* @returns The resulting array of union elements.
*
* @example
Expand All @@ -2033,8 +2029,8 @@ export class BaseClient {
* await client.zunion(["key1", "key2"]) // Output: ['member1', 'member2']
* ```
*/
public zunioun(
keys: string[] | KeyWeight[],
public zunion(
keys: string[],
): Promise<string[]> {
return this.createWritePromise(
createZUnion(keys),
Expand Down
14 changes: 5 additions & 9 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,13 +1095,11 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* See https://valkey.io/commands/zinter/ for more details.
*
* @param keys - The keys of the sorted sets with possible formats:
* string[] - for keys only.
* KeyWeight[] - for weighted keys with score multipliers.
* @param keys - The keys of the sorted sets.
* Command Response - The resulting array of intersecting elements.
*/
public zinter(
keys: string[] | KeyWeight[],
keys: string[],
): T {
return this.addAndReturn(
createZInter(keys),
Expand Down Expand Up @@ -1142,13 +1140,11 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
*
* See https://valkey.io/commands/zunion/ for more details.
*
* @param keys - The keys of the sorted sets with possible formats:
* string[] - for keys only.
* KeyWeight[] - for weighted keys with score multipliers.
* @param keys - The keys of the sorted sets.
* Command Response - The resulting array of union elements.
*/
public zunioun(
keys: string[] | KeyWeight[],
public zunion(
keys: string[],
): T {
return this.addAndReturn(
createZUnion(keys),
Expand Down
Loading

0 comments on commit 26f96f5

Please sign in to comment.