diff --git a/packages/client/lib/commands/SUNION.spec.ts b/packages/client/lib/commands/SUNION.spec.ts index b0ddf782f9..d91baa9c66 100644 --- a/packages/client/lib/commands/SUNION.spec.ts +++ b/packages/client/lib/commands/SUNION.spec.ts @@ -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 + }); +}); diff --git a/packages/client/lib/commands/SUNION.ts b/packages/client/lib/commands/SUNION.ts index f9e7172acb..42042217e2 100644 --- a/packages/client/lib/commands/SUNION.ts +++ b/packages/client/lib/commands/SUNION.ts @@ -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 -// ): RedisCommandArguments { -// return pushVariadicArguments(['SUNION'], keys); -// } - -// export declare function transformReply(): Array; +export default { + FIRST_KEY_INDEX: 1, + IS_READ_ONLY: true, + transformArguments(keys: RedisVariadicArgument) { + return pushVariadicArguments(['SUNION'], keys); + }, + transformReply: undefined as unknown as () => ArrayReply +} as const satisfies Command; diff --git a/packages/client/lib/commands/index.ts b/packages/client/lib/commands/index.ts index 143d9ce3ab..3629b0357d 100644 --- a/packages/client/lib/commands/index.ts +++ b/packages/client/lib/commands/index.ts @@ -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,