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

fix SUNION

This commit is contained in:
dovi
2023-05-03 18:40:36 -04:00
parent 92b38a1f37
commit 627c9122ef
3 changed files with 41 additions and 38 deletions

View File

@@ -1,28 +1,31 @@
// import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './SUNION';
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import SUNION from './SUNION';
// describe('SUNION', () => {
// describe('transformArguments', () => {
// it('string', () => {
// assert.deepEqual(
// transformArguments('key'),
// ['SUNION', 'key']
// );
// });
describe('SUNION', () => {
describe('transformArguments', () => {
it('string', () => {
assert.deepEqual(
SUNION.transformArguments('key'),
['SUNION', 'key']
);
});
// it('array', () => {
// assert.deepEqual(
// transformArguments(['1', '2']),
// ['SUNION', '1', '2']
// );
// });
// });
it('array', () => {
assert.deepEqual(
SUNION.transformArguments(['1', '2']),
['SUNION', '1', '2']
);
});
});
// testUtils.testWithClient('client.sUnion', async client => {
// assert.deepEqual(
// await client.sUnion('key'),
// []
// );
// }, GLOBAL.SERVERS.OPEN);
// });
testUtils.testAll('sUnion', async client => {
assert.deepEqual(
await client.sUnion('key'),
[]
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});

View File

@@ -1,14 +1,11 @@
// import { RedisCommandArgument, RedisCommandArguments } from '.';
// import { pushVariadicArguments } from './generic-transformers';
import { ArrayReply, BlobStringReply, Command } from '../RESP/types';
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
// export const FIRST_KEY_INDEX = 1;
// export const IS_READ_ONLY = true;
// export function transformArguments(
// keys: RedisCommandArgument | Array<RedisCommandArgument>
// ): RedisCommandArguments {
// return pushVariadicArguments(['SUNION'], keys);
// }
// export declare function transformReply(): Array<RedisCommandArgument>;
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: true,
transformArguments(keys: RedisVariadicArgument) {
return pushVariadicArguments(['SUNION'], keys);
},
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
} as const satisfies Command;

View File

@@ -151,6 +151,7 @@ import SRANDMEMBER from './SRANDMEMBER';
import SREM from './SREM';
import SSCAN from './SSCAN';
import STRLEN from './STRLEN';
import SUNION from './SUNION';
import TOUCH from './TOUCH';
import TTL from './TTL';
import TYPE from './TYPE';
@@ -504,6 +505,8 @@ export default {
sScan: SSCAN,
STRLEN,
strLen: STRLEN,
SUNION,
sUnion: SUNION,
TOUCH,
touch: TOUCH,
TTL,