1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/client/lib/commands/ACL_GETUSER.spec.ts
Leibale Eidelman 33a3f3f6c6 run tests with redis 7 as well - copied from #2020 (#2062)
* run tests on redis 7 as well - copied from #2020

* copy some changes from #2020

* clean BITCOUNT
2022-03-30 08:12:21 -04:00

45 lines
1.4 KiB
TypeScript

import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './ACL_GETUSER';
describe('ACL GETUSER', () => {
testUtils.isVersionGreaterThanHook([6]);
it('transformArguments', () => {
assert.deepEqual(
transformArguments('username'),
['ACL', 'GETUSER', 'username']
);
});
testUtils.testWithClient('client.aclGetUser', async client => {
const expectedReply: any = {
passwords: [],
commands: '+@all',
};
if (testUtils.isVersionGreaterThan([7])) {
expectedReply.flags = ['on', 'nopass'];
expectedReply.keys = '~*';
expectedReply.channels = '&*';
expectedReply.selectors = [];
} else {
expectedReply.keys = ['*'];
expectedReply.selectors = undefined;
if (testUtils.isVersionGreaterThan([6, 2])) {
expectedReply.flags = ['on', 'allkeys', 'allchannels', 'allcommands', 'nopass'];
expectedReply.channels = ['*'];
} else {
expectedReply.flags = ['on', 'allkeys', 'allcommands', 'nopass'];
expectedReply.channels = undefined;
}
}
assert.deepEqual(
await client.aclGetUser('default'),
expectedReply
);
}, GLOBAL.SERVERS.OPEN);
});