mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(BaseRedisBroker): proper import path to lua script (#8776)
* fix(BaseRedisBroker): proper import path to lua script * chore: fix tests Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,12 @@ import type Redis from 'ioredis';
|
|||||||
import { test, expect, vi } from 'vitest';
|
import { test, expect, vi } from 'vitest';
|
||||||
import { PubSubRedisBroker } from '../src/index.js';
|
import { PubSubRedisBroker } from '../src/index.js';
|
||||||
|
|
||||||
|
vi.mock('node:fs', () => {
|
||||||
|
return {
|
||||||
|
readFileSync: vi.fn(),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const mockRedisClient = {
|
const mockRedisClient = {
|
||||||
defineCommand: vi.fn(),
|
defineCommand: vi.fn(),
|
||||||
xadd: vi.fn(),
|
xadd: vi.fn(),
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export abstract class BaseRedisBroker<TEvents extends Record<string, any>>
|
|||||||
this.options = { ...DefaultBrokerOptions, ...options };
|
this.options = { ...DefaultBrokerOptions, ...options };
|
||||||
options.redisClient.defineCommand('xcleangroup', {
|
options.redisClient.defineCommand('xcleangroup', {
|
||||||
numberOfKeys: 1,
|
numberOfKeys: 1,
|
||||||
lua: readFileSync(resolve(__dirname, '..', '..', '..', 'scripts', 'xcleangroup.lua'), 'utf8'),
|
lua: readFileSync(resolve(__dirname, '..', 'scripts', 'xcleangroup.lua'), 'utf8'),
|
||||||
});
|
});
|
||||||
this.streamReadClient = options.redisClient.duplicate();
|
this.streamReadClient = options.redisClient.duplicate();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user