You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
* Added MSET command MSET command added. Requires all keys to have the same JSON Path, which might fit most use cases, but is a limitation. Optionally we could make the path an array as well to support all use cases. * change JSON.MSET signature, add to json command object, fix tests * its `item.value`, not `item.json`.. * Update MSET.ts Removed unused RedisCommandArguments --------- Co-authored-by: Leibale Eidelman <me@leibale.com>
36 lines
916 B
TypeScript
36 lines
916 B
TypeScript
import { strict as assert } from 'assert';
|
|
import testUtils, { GLOBAL } from '../test-utils';
|
|
import { transformArguments } from './MSET';
|
|
|
|
describe('MSET', () => {
|
|
it('transformArguments', () => {
|
|
assert.deepEqual(
|
|
transformArguments([{
|
|
key: '1',
|
|
path: '$',
|
|
value: 1
|
|
}, {
|
|
key: '2',
|
|
path: '$',
|
|
value: '2'
|
|
}]),
|
|
['JSON.MSET', '1', '$', '1', '2', '$', '"2"']
|
|
);
|
|
});
|
|
|
|
testUtils.testWithClient('client.json.mSet', async client => {
|
|
assert.deepEqual(
|
|
await client.json.mSet([{
|
|
key: '1',
|
|
path: '$',
|
|
value: 1
|
|
}, {
|
|
key: '2',
|
|
path: '$',
|
|
value: '2'
|
|
}]),
|
|
'OK'
|
|
);
|
|
}, GLOBAL.SERVERS.OPEN);
|
|
});
|