Debian Codegraph @

packages/bloom/lib/commands/t-digest/MERGE.spec.ts

raw symbols SCIP
1 import { strict as assert } from 'assert';
2 import testUtils, { GLOBAL } from '../../test-utils';
3 import { transformArguments, transformReply } from './MERGE';
4
5 describe('TDIGEST.MERGE', () => {
6 describe('transformArguments', () => {
7 describe('srcKeys', () => {
8 it('string', () => {
9 assert.deepEqual(
10 transformArguments('dest', 'src'),
11 ['TDIGEST.MERGE', 'dest', '1', 'src']
12 );
13 });
14
15 it('Array', () => {
16 assert.deepEqual(
17 transformArguments('dest', ['1', '2']),
18 ['TDIGEST.MERGE', 'dest', '2', '1', '2']
19 );
20 });
21 });
22
23 it('with COMPRESSION', () => {
24 assert.deepEqual(
25 transformArguments('dest', 'src', {
26 COMPRESSION: 100
27 }),
28 ['TDIGEST.MERGE', 'dest', '1', 'src', 'COMPRESSION', '100']
29 );
30 });
31
32 it('with OVERRIDE', () => {
33 assert.deepEqual(
34 transformArguments('dest', 'src', {
35 OVERRIDE: true
36 }),
37 ['TDIGEST.MERGE', 'dest', '1', 'src', 'OVERRIDE']
38 );
39 });
40 });
41
42 testUtils.testWithClient('client.tDigest.merge', async client => {
43 const [ , reply ] = await Promise.all([
44 client.tDigest.create('src'),
45 client.tDigest.merge('dest', 'src')
46 ]);
47
48 assert.equal(reply, 'OK');
49 }, GLOBAL.SERVERS.OPEN);
50 });