You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
V5 bringing RESP3, Sentinel and TypeMapping to node-redis
RESP3 Support - Some commands responses in RESP3 aren't stable yet and therefore return an "untyped" ReplyUnion. Sentinel TypeMapping Correctly types Multi commands Note: some API changes to be further documented in v4-to-v5.md
This commit is contained in:
@@ -1,31 +1,36 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import testUtils, { GLOBAL } from '../../test-utils';
|
||||
import { transformArguments } from './LOADCHUNK';
|
||||
import LOADCHUNK from './LOADCHUNK';
|
||||
import { RESP_TYPES } from '@redis/client';
|
||||
|
||||
describe('CF LOADCHUNK', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('item', 0, ''),
|
||||
['CF.LOADCHUNK', 'item', '0', '']
|
||||
);
|
||||
});
|
||||
describe('CF.LOADCHUNK', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
LOADCHUNK.transformArguments('item', 0, ''),
|
||||
['CF.LOADCHUNK', 'item', '0', '']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.cf.loadChunk', async client => {
|
||||
const [,, { iterator, chunk }] = await Promise.all([
|
||||
client.cf.reserve('source', 4),
|
||||
client.cf.add('source', 'item'),
|
||||
client.cf.scanDump(
|
||||
client.commandOptions({ returnBuffers: true }),
|
||||
'source',
|
||||
0
|
||||
)
|
||||
]);
|
||||
testUtils.testWithClient('client.cf.loadChunk', async client => {
|
||||
const [, , { iterator, chunk }] = await Promise.all([
|
||||
client.cf.reserve('source', 4),
|
||||
client.cf.add('source', 'item'),
|
||||
client.cf.scanDump('source', 0)
|
||||
]);
|
||||
|
||||
assert.ok(Buffer.isBuffer(chunk));
|
||||
|
||||
assert.equal(
|
||||
await client.cf.loadChunk('destination', iterator, chunk),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
assert.equal(
|
||||
await client.cf.loadChunk('destination', iterator, chunk!),
|
||||
'OK'
|
||||
);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
clientOptions: {
|
||||
...GLOBAL.SERVERS.OPEN.clientOptions,
|
||||
commandOptions: {
|
||||
typeMapping: {
|
||||
[RESP_TYPES.BLOB_STRING]: Buffer
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user