1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

more commands

This commit is contained in:
dovi
2023-07-10 12:29:36 -04:00
parent 9915d67510
commit d2b0b4e5b0
12 changed files with 196 additions and 156 deletions

View File

@@ -1,30 +1,30 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './ARRAPPEND';
import ARRAPPEND from './ARRAPPEND';
describe('ARRAPPEND', () => {
describe('transformArguments', () => {
it('single JSON', () => {
assert.deepEqual(
transformArguments('key', '$', 1),
['JSON.ARRAPPEND', 'key', '$', '1']
);
});
it('multiple JSONs', () => {
assert.deepEqual(
transformArguments('key', '$', 1, 2),
['JSON.ARRAPPEND', 'key', '$', '1', '2']
);
});
describe('transformArguments', () => {
it('single JSON', () => {
assert.deepEqual(
ARRAPPEND.transformArguments('key', '$', 1),
['JSON.ARRAPPEND', 'key', '$', '1']
);
});
testUtils.testWithClient('client.json.arrAppend', async client => {
await client.json.set('key', '$', []);
it('multiple JSONs', () => {
assert.deepEqual(
ARRAPPEND.transformArguments('key', '$', 1, 2),
['JSON.ARRAPPEND', 'key', '$', '1', '2']
);
});
});
assert.deepEqual(
await client.json.arrAppend('key', '$', 1),
[1]
);
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithClient('client.json.arrAppend', async client => {
await client.json.set('key', '$', []);
assert.deepEqual(
await client.json.arrAppend('key', '$', 1),
[1]
);
}, GLOBAL.SERVERS.OPEN);
});