1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/time-series/lib/commands/CREATERULE.spec.ts
Simon Prickett d602682b64 Adding a RedisTimeSeries example (#1839)
* Adds the start of a timeseries example.

* Exports required TimeSeries items.

* Fixed import.

* Added TS.INFO example output.

* Fixed typo.

* Fixed typo.

* Exported aggregation enum.

* Working time series example.

Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
2022-01-19 13:35:18 -05:00

26 lines
866 B
TypeScript

import { strict as assert } from 'assert';
import { TimeSeriesAggregationType } from '.';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CREATERULE';
describe('CREATERULE', () => {
it('transformArguments', () => {
assert.deepEqual(
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'avg', '1']
);
});
testUtils.testWithClient('client.ts.createRule', async client => {
await Promise.all([
client.ts.create('source'),
client.ts.create('destination')
]);
assert.equal(
await client.ts.createRule('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});