You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
* wip * close #2216 - add support for TDIGEST.MERGESTORE and make compression optional on TDIGEST.CREATE * fix some tdigest commands, use bloom edge docker * fix index.ts * 2.4-RC2 (v2.4.1) * fix some commands and tests * clean code
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { strict as assert } from 'assert';
|
|
import testUtils, { GLOBAL } from '../../test-utils';
|
|
import { transformArguments, transformReply } from './MERGE';
|
|
|
|
describe('TDIGEST.MERGE', () => {
|
|
describe('transformArguments', () => {
|
|
describe('srcKeys', () => {
|
|
it('string', () => {
|
|
assert.deepEqual(
|
|
transformArguments('dest', 'src'),
|
|
['TDIGEST.MERGE', 'dest', '1', 'src']
|
|
);
|
|
});
|
|
|
|
it('Array', () => {
|
|
assert.deepEqual(
|
|
transformArguments('dest', ['1', '2']),
|
|
['TDIGEST.MERGE', 'dest', '2', '1', '2']
|
|
);
|
|
});
|
|
});
|
|
|
|
it('with COMPRESSION', () => {
|
|
assert.deepEqual(
|
|
transformArguments('dest', 'src', {
|
|
COMPRESSION: 100
|
|
}),
|
|
['TDIGEST.MERGE', 'dest', '1', 'src', 'COMPRESSION', '100']
|
|
);
|
|
});
|
|
|
|
it('with OVERRIDE', () => {
|
|
assert.deepEqual(
|
|
transformArguments('dest', 'src', {
|
|
OVERRIDE: true
|
|
}),
|
|
['TDIGEST.MERGE', 'dest', '1', 'src', 'OVERRIDE']
|
|
);
|
|
});
|
|
});
|
|
|
|
testUtils.testWithClient('client.tDigest.merge', async client => {
|
|
const [ , reply ] = await Promise.all([
|
|
client.tDigest.create('src'),
|
|
client.tDigest.merge('dest', 'src')
|
|
]);
|
|
|
|
assert.equal(reply, 'OK');
|
|
}, GLOBAL.SERVERS.OPEN);
|
|
});
|