packages/json/lib/commands/GET.spec.ts
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import GET from './GET';
import { parseArgs } from '@redis/client/lib/commands/generic-transformers';
describe('JSON.GET', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
parseArgs(GET, 'key'),
['JSON.GET', 'key']
);
});
describe('with path', () => {
it('string', () => {
assert.deepEqual(
parseArgs(GET, 'key', { path: '$' }),
['JSON.GET', 'key', '$']
);
});
it('array', () => {
assert.deepEqual(
parseArgs(GET, '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);
});