Debian Codegraph @

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

raw
1 import { strict as assert } from 'assert';
2 import { TimeSeriesAggregationType, TimeSeriesDuplicatePolicies } from '.';
3 import testUtils, { GLOBAL } from '../test-utils';
4 import { assertInfo } from './INFO.spec';
5 import { transformArguments } from './INFO_DEBUG';
6
7 describe('INFO_DEBUG', () => {
8 it('transformArguments', () => {
9 assert.deepEqual(
10 transformArguments('key'),
11 ['TS.INFO', 'key', 'DEBUG']
12 );
13 });
14
15 testUtils.testWithClient('client.ts.get', async client => {
16 await Promise.all([
17 client.ts.create('key', {
18 LABELS: { id: '1' },
19 DUPLICATE_POLICY: TimeSeriesDuplicatePolicies.LAST
20 }),
21 client.ts.create('key2'),
22 client.ts.createRule('key', 'key2', TimeSeriesAggregationType.COUNT, 5),
23 client.ts.add('key', 1, 10)
24 ]);
25
26 const infoDebug = await client.ts.infoDebug('key');
27 assertInfo(infoDebug);
28 assert.equal(typeof infoDebug.keySelfName, 'string');
29 assert.ok(Array.isArray(infoDebug.chunks));
30 for (const chunk of infoDebug.chunks) {
31 assert.equal(typeof chunk, 'object');
32 assert.equal(typeof chunk.startTimestamp, 'number');
33 assert.equal(typeof chunk.endTimestamp, 'number');
34 assert.equal(typeof chunk.samples, 'number');
35 assert.equal(typeof chunk.size, 'number');
36 assert.equal(typeof chunk.bytesPerSample, 'string');
37 }
38 }, GLOBAL.SERVERS.OPEN);
39 });