1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/json/lib/commands/ARRLEN.spec.ts
2023-07-10 17:41:02 -04:00

31 lines
729 B
TypeScript

import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import ARRLEN from './ARRLEN';
describe('JSON.ARRLEN', () => {
describe('transformArguments', () => {
it('without path', () => {
assert.deepEqual(
ARRLEN.transformArguments('key'),
['JSON.ARRLEN', 'key']
);
});
it('with path', () => {
assert.deepEqual(
ARRLEN.transformArguments('key', '$'),
['JSON.ARRLEN', 'key', '$']
);
});
});
testUtils.testWithClient('client.json.arrLen', async client => {
await client.json.set('key', '$', []);
assert.deepEqual(
await client.json.arrLen('key', '$'),
[0]
);
}, GLOBAL.SERVERS.OPEN);
});