Skip to content

Commit e58c1ea

Browse files
committed
fix: test
1 parent 42433c1 commit e58c1ea

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/RedisQueue.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,6 @@ export class RedisQueue extends EventEmitter<EventMap>
801801
),
802802
retryStrategy: this.retryStrategy(context),
803803
autoResubscribe: true,
804-
enableReadyCheck: true,
805804
enableOfflineQueue: true,
806805
autoResendUnfulfilledCommands: true,
807806
offlineQueue: true,
@@ -1174,7 +1173,7 @@ export class RedisQueue extends EventEmitter<EventMap>
11741173
*/
11751174
// istanbul ignore next
11761175
private watch(): RedisQueue {
1177-
if (!this.watcher || this.watcher.__ready__) {
1176+
if (!this.writer || !this.watcher || this.watcher.__ready__) {
11781177
return this;
11791178
}
11801179

test/mocks/redis.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@ export class RedisClientMock extends EventEmitter {
6060
// noinspection JSUnusedGlobalSymbols
6161
public end() {}
6262
// noinspection JSUnusedGlobalSymbols
63-
public quit() {}
63+
public quit() {
64+
return new Promise(resolve => resolve(undefined));
65+
}
6466

6567
// noinspection JSMethodCanBeStatic
66-
public set(...args: any[]): number {
68+
public set(...args: any[]): Promise<number> {
6769
const [key, val] = args;
6870
RedisClientMock.__keys[key] = val;
6971
this.cbExecute(args.pop(), null, 1);
70-
return 1;
72+
return new Promise(resolve => resolve(1));
7173
}
7274

7375
// noinspection JSUnusedGlobalSymbols,JSMethodCanBeStatic
@@ -230,14 +232,14 @@ export class RedisClientMock extends EventEmitter {
230232
}
231233

232234
// noinspection JSUnusedGlobalSymbols,JSMethodCanBeStatic
233-
public psubscribe(...args: any[]): number {
235+
public psubscribe(...args: any[]): Promise<number> {
234236
this.cbExecute(args.pop(), null, 1);
235-
return 1;
237+
return new Promise(resolve => resolve(1));
236238
}
237239

238-
public punsubscribe(...args: any[]): number {
240+
public punsubscribe(...args: any[]): Promise<number> {
239241
this.cbExecute(args.pop(), null, 1);
240-
return 1;
242+
return new Promise(resolve => resolve(1));
241243
}
242244

243245
// noinspection JSUnusedGlobalSymbols,JSMethodCanBeStatic
@@ -247,7 +249,7 @@ export class RedisClientMock extends EventEmitter {
247249
}
248250

249251
// noinspection JSUnusedGlobalSymbols,JSMethodCanBeStatic
250-
public del(...args: any[]): number {
252+
public del(...args: any[]): Promise<number> {
251253
const self = RedisClientMock;
252254
let count = 0;
253255
for (let key of args) {
@@ -261,7 +263,7 @@ export class RedisClientMock extends EventEmitter {
261263
}
262264
}
263265
this.cbExecute(args.pop(), count);
264-
return count;
266+
return new Promise(resolve => resolve(count));
265267
}
266268

267269
// noinspection JSUnusedGlobalSymbols
@@ -303,8 +305,8 @@ export class RedisClientMock extends EventEmitter {
303305
}
304306

305307
// noinspection JSUnusedGlobalSymbols,JSMethodCanBeStatic
306-
public config(): boolean {
307-
return true;
308+
public config(): Promise<boolean> {
309+
return new Promise(resolve => resolve(true));
308310
}
309311

310312
private cbExecute(cb: any, ...args: any[]): void {

0 commit comments

Comments
 (0)