Skip to content

Commit 199f3e8

Browse files
Merge pull request #14 from Aditya-ds-1806/update/move-tests-to-ts
update: moved tests to TS, testing framework to jest, run tests on src files
2 parents 37248b3 + a4d1d26 commit 199f3e8

File tree

9 files changed

+3697
-991
lines changed

9 files changed

+3697
-991
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules
33
build
44
dist
5+
coverage

index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* --------------------------------------------------------------
44
* This file was automatically generated.
55
* Source: build.ts
6-
* Date: 2025-05-04T20:00:48.602Z
6+
* Date: 2025-05-12T18:27:01.281Z
77
*
88
* ⚠️ DO NOT MODIFY THIS FILE MANUALLY ⚠️
99
* Changes will be overwritten the next time it is built.
@@ -75,7 +75,7 @@ class DiceDB extends DiceDBBase {
7575
* @param {string} [message=''] - The message to be echoed back.
7676
* @returns A promise that resolves with the echoed message.
7777
*/
78-
async echo(message: string) {
78+
async echo(message?: string) {
7979
return this.execCommand('ECHO', message) as Promise<DiceDBResponse>;
8080
}
8181

@@ -99,7 +99,7 @@ class DiceDB extends DiceDBBase {
9999
* @param condition - The condition for setting the timeout.
100100
* @returns A promise that resolves with a boolean indicating if the timeout was set.
101101
*/
102-
async expire(key: string, seconds: number, condition: "NX" | "XX" | undefined) {
102+
async expire(key: string, seconds: number, condition?: 'NX' | 'XX') {
103103
return this.execCommand('EXPIRE', key, seconds, condition) as Promise<DiceDBResponse>;
104104
}
105105

@@ -112,7 +112,7 @@ class DiceDB extends DiceDBBase {
112112
* @param condition - The condition for setting the timeout.
113113
* @returns A promise that resolves with a boolean indicating if the timeout was set.
114114
*/
115-
async expireAt(key: string, timestamp: number, condition: "NX" | "XX" | "GT" | "LT" | undefined) {
115+
async expireAt(key: string, timestamp: number, condition?: 'NX' | 'XX' | 'GT' | 'LT') {
116116
return this.execCommand('EXPIREAT', key, timestamp, condition) as Promise<DiceDBResponse>;
117117
}
118118

@@ -167,7 +167,7 @@ class DiceDB extends DiceDBBase {
167167
* @param opts - The options for setting the expiry.
168168
* @returns A promise that resolves with the value of the key.
169169
*/
170-
async getAndSetExpiry(key: string, opts: GetAndSetExpiryCommandOptions) {
170+
async getAndSetExpiry(key: string, opts?: GetAndSetExpiryCommandOptions) {
171171
return this.execCommand('GETEX', key, opts) as Promise<DiceDBResponse>;
172172
}
173173

@@ -179,7 +179,7 @@ class DiceDB extends DiceDBBase {
179179
* @param {number | string} value - The value to set.
180180
* @returns A promise that resolves with the old value of the key.
181181
*/
182-
async getSet(key: string, value: string | number) {
182+
async getSet(key: string, value: number | string) {
183183
return this.execCommand('GETSET', key, value) as Promise<DiceDBResponse>;
184184
}
185185

@@ -248,7 +248,7 @@ class DiceDB extends DiceDBBase {
248248
* @param {Record<string, number | string> | Map<string, number | string>} map - An object representing field-value pairs to set in the hash.
249249
* @returns A promise that resolves with the result of the command execution.
250250
*/
251-
async hSet(key: string, map: Record<string, string | number> | Map<string, string | number>) {
251+
async hSet(key: string, map: Record<string, number | string> | Map<string, number | string>) {
252252
return this.execCommand('HSET', key, map) as Promise<DiceDBResponse>;
253253
}
254254

@@ -259,7 +259,7 @@ class DiceDB extends DiceDBBase {
259259
* @param {'command' | 'watch'} execMode - The execution mode for the handshake.
260260
* @returns A promise that resolves when the handshake is successful.
261261
*/
262-
async handshake(execMode: "command" | "watch") {
262+
async handshake(execMode: 'command' | 'watch') {
263263
return this.execCommand('HANDSHAKE', execMode) as Promise<DiceDBResponse>;
264264
}
265265

@@ -304,7 +304,7 @@ class DiceDB extends DiceDBBase {
304304
* @param {string} [message] - An optional message to send with the PING command.
305305
* @returns A promise that resolves with the server's response.
306306
*/
307-
async ping(message: string | undefined) {
307+
async ping(message?: string) {
308308
return this.execCommand('PING', message) as Promise<DiceDBResponse>;
309309
}
310310

@@ -317,7 +317,7 @@ class DiceDB extends DiceDBBase {
317317
* @param opts - The options for setting the key, such as expiry time.
318318
* @returns A promise that resolves when the key is set successfully.
319319
*/
320-
async set(key: string, value: string | number, opts: SetCommandOptions) {
320+
async set(key: string, value: string | number, opts?: SetCommandOptions) {
321321
return this.execCommand('SET', key, value, opts) as Promise<DiceDBResponse>;
322322
}
323323

@@ -364,7 +364,7 @@ class DiceDB extends DiceDBBase {
364364
* @param opts - The options for adding elements to the sorted set.
365365
* @returns A promise that resolves when the elements are added successfully.
366366
*/
367-
async zAdd(key: string, map: Record<string, string | number> | Map<string, string | number>, opts: ZAddCommandOptions | undefined) {
367+
async zAdd(key: string, map: Record<string, number | string> | Map<string, number | string>, opts?: ZAddCommandOptions) {
368368
return this.execCommand('ZADD', key, map, opts) as Promise<DiceDBResponse>;
369369
}
370370

@@ -398,7 +398,7 @@ class DiceDB extends DiceDBBase {
398398
* @param {ZCountOptions} opts - Options specifying the score range
399399
* @returns Count of members with scores in the range
400400
*/
401-
async zCount(key: string, opts: ZCountOptions | undefined) {
401+
async zCount(key: string, opts?: ZCountOptions) {
402402
return this.execCommand('ZCOUNT', key, opts) as Promise<DiceDBResponse>;
403403
}
404404

@@ -410,7 +410,7 @@ class DiceDB extends DiceDBBase {
410410
* @param {ZCountOptions} opts - Options specifying the score range
411411
* @returns The number of members in the sorted set
412412
*/
413-
async zCountWatch(key: string, opts: ZCountOptions | undefined) {
413+
async zCountWatch(key: string, opts?: ZCountOptions) {
414414
return this.execCommand('ZCOUNT.WATCH', key, opts) as Promise<Readable>;
415415
}
416416

@@ -422,7 +422,7 @@ class DiceDB extends DiceDBBase {
422422
* @param {number} count - Options specifying the number of elements to pop
423423
* @returns The member with the highest score and its score
424424
*/
425-
async zPopMax(key: string, count: number | undefined) {
425+
async zPopMax(key: string, count?: number) {
426426
return this.execCommand('ZPOPMAX', key, count) as Promise<DiceDBResponse>;
427427
}
428428

@@ -434,7 +434,7 @@ class DiceDB extends DiceDBBase {
434434
* @param {number} count - Options specifying the number of elements to pop
435435
* @returns The member with the lowest score and its score
436436
*/
437-
async zPopMin(key: string, count: number | undefined) {
437+
async zPopMin(key: string, count?: number) {
438438
return this.execCommand('ZPOPMIN', key, count) as Promise<DiceDBResponse>;
439439
}
440440

0 commit comments

Comments
 (0)