-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathHELLO.spec.ts
75 lines (68 loc) · 1.87 KB
/
HELLO.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import HELLO from './HELLO';
describe('HELLO', () => {
testUtils.isVersionGreaterThanHook([6]);
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
HELLO.transformArguments(),
['HELLO']
);
});
it('with protover', () => {
assert.deepEqual(
HELLO.transformArguments(3),
['HELLO', '3']
);
});
it('with protover, AUTH', () => {
assert.deepEqual(
HELLO.transformArguments(3, {
AUTH: {
username: 'username',
password: 'password'
}
}),
['HELLO', '3', 'AUTH', 'username', 'password']
);
});
it('with protover, SETNAME', () => {
assert.deepEqual(
HELLO.transformArguments(3, {
SETNAME: 'name'
}),
['HELLO', '3', 'SETNAME', 'name']
);
});
it('with protover, AUTH, SETNAME', () => {
assert.deepEqual(
HELLO.transformArguments(3, {
AUTH: {
username: 'username',
password: 'password'
},
SETNAME: 'name'
}),
['HELLO', '3', 'AUTH', 'username', 'password', 'SETNAME', 'name']
);
});
});
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');
if (process.env.REDIS_ENTERPRISE === undefined) {
assert.equal(reply.mode, 'standalone');
} else {
assert.equal(reply.mode, 'cluster');
}
assert.equal(reply.role, 'master');
assert.deepEqual(reply.modules, []);
}, {
...GLOBAL.SERVERS.OPEN,
minimumDockerVersion: [6, 2],
});
});