1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

add CLUSTER_SLOTS, add some tests

This commit is contained in:
leibale
2021-09-23 16:17:00 -04:00
parent 9237a4e68a
commit 42dcf802b1
4 changed files with 149 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import RedisClient from './client';
import { AbortError, ClientClosedError, ConnectionTimeoutError, WatchError } from './errors';
import { defineScript } from './lua-script';
import { spy } from 'sinon';
import { RedisNetSocketOptions } from './socket';
export const SQUARE_SCRIPT = defineScript({
NUMBER_OF_KEYS: 0,
@@ -63,6 +64,34 @@ describe('Client', () => {
TypeError
);
});
it('redis://localhost', () => {
assert.deepEqual(
RedisClient.parseURL('redis://localhost'),
{
socket: {
host: 'localhost',
}
}
);
});
it('createClient with url', async () => {
const client = RedisClient.create({
url: `redis://localhost:${(TEST_REDIS_SERVERS[TestRedisServers.OPEN].socket as RedisNetSocketOptions)!.port!.toString()}/1`
});
await client.connect();
try {
assert.equal(
(await client.clientInfo()).db,
1
);
} finally {
await client.disconnect();
}
});
});
describe('authentication', () => {