Debian Codegraph @

packages/time-series/lib/commands/MGET_WITHLABELS.spec.ts

raw
1 import { strict as assert } from 'assert';
2 import testUtils, { GLOBAL } from '../test-utils';
3 import { transformArguments } from './MGET_WITHLABELS';
4
5 describe('MGET_WITHLABELS', () => {
6 describe('transformArguments', () => {
7 it('without options', () => {
8 assert.deepEqual(
9 transformArguments('label=value'),
10 ['TS.MGET', 'WITHLABELS', 'FILTER', 'label=value']
11 );
12 });
13
14 it('with SELECTED_LABELS', () => {
15 assert.deepEqual(
16 transformArguments('label=value', { SELECTED_LABELS: 'label' }),
17 ['TS.MGET', 'SELECTED_LABELS', 'label', 'FILTER', 'label=value']
18 );
19 });
20 });
21
22 testUtils.testWithClient('client.ts.mGetWithLabels', async client => {
23 await client.ts.add('key', 0, 0, {
24 LABELS: { label: 'value' }
25 });
26
27 assert.deepEqual(
28 await client.ts.mGetWithLabels('label=value'),
29 [{
30 key: 'key',
31 labels: { label: 'value'},
32 sample: {
33 timestamp: 0,
34 value: 0
35 }
36 }]
37 );
38 }, GLOBAL.SERVERS.OPEN);
39 });