You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
use dockers for tests, use npm workspaces, add rejson & redisearch modules, fix some bugs
This commit is contained in:
76
packages/client/lib/commands/HELLO.spec.ts
Normal file
76
packages/client/lib/commands/HELLO.spec.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './HELLO';
|
||||
|
||||
describe('HELLO', () => {
|
||||
testUtils.isVersionGreaterThanHook([6]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['HELLO']
|
||||
);
|
||||
});
|
||||
|
||||
it('with protover', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
protover: 3
|
||||
}),
|
||||
['HELLO', '3']
|
||||
);
|
||||
});
|
||||
|
||||
it('with protover, auth', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
protover: 3,
|
||||
auth: {
|
||||
username: 'username',
|
||||
password: 'password'
|
||||
}
|
||||
}),
|
||||
['HELLO', '3', 'AUTH', 'username', 'password']
|
||||
);
|
||||
});
|
||||
|
||||
it('with protover, clientName', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
protover: 3,
|
||||
clientName: 'clientName'
|
||||
}),
|
||||
['HELLO', '3', 'SETNAME', 'clientName']
|
||||
);
|
||||
});
|
||||
|
||||
it('with protover, auth, clientName', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
protover: 3,
|
||||
auth: {
|
||||
username: 'username',
|
||||
password: 'password'
|
||||
},
|
||||
clientName: 'clientName'
|
||||
}),
|
||||
['HELLO', '3', 'AUTH', 'username', 'password', 'SETNAME', 'clientName']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.hello', async client => {
|
||||
const reply = await client.hello();
|
||||
assert.equal(reply.server, 'redis');
|
||||
assert.equal(typeof reply.version, 'string');
|
||||
assert.equal(reply.proto, 2);
|
||||
assert.equal(typeof reply.id, 'number');
|
||||
assert.equal(reply.mode, 'standalone');
|
||||
assert.equal(reply.role, 'master');
|
||||
assert.deepEqual(reply.modules, []);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
minimumDockerVersion: [6, 2]
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user