1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/time-series/lib/commands/CREATERULE.spec.ts
2021-11-29 12:47:17 -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.AVARAGE, 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.AVARAGE, 1),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
});