1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-17 19:41:06 +03:00

spawn redis-servers for tests,

add some tests,
fix client auth on connect
This commit is contained in:
leibale
2021-05-12 18:27:35 -04:00
parent b2f0eb3460
commit 38b2bd75fb
20 changed files with 220 additions and 345 deletions

View File

@@ -13,11 +13,11 @@ export interface RedisClientOptions<M = RedisModules> {
export type RedisCommandSignature<C extends RedisCommand> = (...args: Parameters<C['transformArguments']>) => Promise<ReturnType<C['transformReply']>>;
type WithCommands = {
[P in keyof typeof COMMANDS]: RedisCommandSignature<(typeof COMMANDS)[P]>
[P in keyof typeof COMMANDS]: RedisCommandSignature<(typeof COMMANDS)[P]>;
};
type WithModules<M extends Array<RedisModule>> = {
[P in keyof M[number]]: RedisCommandSignature<M[number][P]>
[P in keyof M[number]]: RedisCommandSignature<M[number][P]>;
};
type WithMulti<M extends Array<RedisModule>> = {
@@ -55,7 +55,7 @@ export default class RedisClient extends EventEmitter {
#initiateSocket(socketOptions?: RedisSocketOptions): RedisSocket {
const socketInitiator = async (): Promise<void> => {
if (socketOptions?.password) {
await (this as any).auth(socketOptions.username, socketOptions.password);
await (this as any).auth(socketOptions);
}
};
@@ -71,7 +71,7 @@ export default class RedisClient extends EventEmitter {
#initiateMulti() {
const executor = async (commands: Array<MultiQueuedCommand>): Promise<Array<RedisReply>> => {
const promise = Promise.all(
commands.map(({ encodedCommand }) => {
commands.map(({encodedCommand}) => {
return this.#queue.addEncodedCommand<RedisReply>(encodedCommand);
})
);