1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/packages/json/lib/commands/GET.spec.ts
2023-09-05 18:19:31 -04:00

38 lines
890 B
TypeScript

import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import GET from './GET';
describe('JSON.GET', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
GET.transformArguments('key'),
['JSON.GET', 'key']
);
});
describe('with path', () => {
it('string', () => {
assert.deepEqual(
GET.transformArguments('key', { path: '$' }),
['JSON.GET', 'key', '$']
);
});
it('array', () => {
assert.deepEqual(
GET.transformArguments('key', { path: ['$.1', '$.2'] }),
['JSON.GET', 'key', '$.1', '$.2']
);
});
});
});
testUtils.testWithClient('client.json.get', async client => {
assert.equal(
await client.json.get('key'),
null
);
}, GLOBAL.SERVERS.OPEN);
});