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

fix SMOVE

This commit is contained in:
dovi
2023-05-03 18:23:45 -04:00
parent a8679f37ec
commit 65c691fd75
5 changed files with 37 additions and 30 deletions

View File

@@ -1,19 +1,22 @@
// import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './SMOVE';
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import SMOVE from './SMOVE';
// describe('SMOVE', () => {
// it('transformArguments', () => {
// assert.deepEqual(
// transformArguments('source', 'destination', 'member'),
// ['SMOVE', 'source', 'destination', 'member']
// );
// });
describe('SMOVE', () => {
it('transformArguments', () => {
assert.deepEqual(
SMOVE.transformArguments('source', 'destination', 'member'),
['SMOVE', 'source', 'destination', 'member']
);
});
// testUtils.testWithClient('client.sMove', async client => {
// assert.equal(
// await client.sMove('source', 'destination', 'member'),
// false
// );
// }, GLOBAL.SERVERS.OPEN);
// });
testUtils.testAll('sMove', async client => {
assert.equal(
await client.sMove('{tag}source', '{tag}destination', 'member'),
0
);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});

View File

@@ -1,13 +1,14 @@
// import { RedisCommandArgument, RedisCommandArguments } from '.';
import { RedisArgument, NumberReply, Command } from '../RESP/types';
// export const FIRST_KEY_INDEX = 1;
// export function transformArguments(
// source: RedisCommandArgument,
// destination: RedisCommandArgument,
// member: RedisCommandArgument
// ): RedisCommandArguments {
// return ['SMOVE', source, destination, member];
// }
// export { transformBooleanReply as transformReply } from './generic-transformers';
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: false,
transformArguments(
source: RedisArgument,
destination: RedisArgument,
member: RedisArgument
) {
return ['SMOVE', source, destination, member];
},
transformReply: undefined as unknown as () => NumberReply
} as const satisfies Command;

View File

@@ -139,6 +139,7 @@ import SINTERSTORE from './SINTERSTORE';
import SISMEMBER from './SISMEMBER';
import SMEMBERS from './SMEMBERS';
import SMISMEMBER from './SMISMEMBER';
import SMOVE from './SMOVE';
import SORT_RO from './SORT_RO';
import SORT_STORE from './SORT_STORE';
import SORT from './SORT';
@@ -479,6 +480,8 @@ export default {
sMembers: SMEMBERS,
SMISMEMBER,
smIsMember: SMISMEMBER,
SMOVE,
sMove: SMOVE,
SORT_RO,
sortRo: SORT_RO,
SORT_STORE,