You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
fix CREATERULE
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { TimeSeriesAggregationType } from '.';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CREATERULE';
|
||||
import CREATERULE from './CREATERULE';
|
||||
|
||||
describe('CREATERULE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('without options', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
|
||||
CREATERULE.transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
|
||||
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1']
|
||||
);
|
||||
});
|
||||
|
||||
it('with alignTimestamp', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1, 1),
|
||||
CREATERULE.transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1, 1),
|
||||
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1', '1']
|
||||
);
|
||||
});
|
||||
|
@@ -1,14 +1,16 @@
|
||||
import { TimeSeriesAggregationType } from '.';
|
||||
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
sourceKey: string,
|
||||
destinationKey: string,
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
sourceKey: RedisArgument,
|
||||
destinationKey: RedisArgument,
|
||||
aggregationType: TimeSeriesAggregationType,
|
||||
bucketDuration: number,
|
||||
alignTimestamp?: number
|
||||
): Array<string> {
|
||||
) {
|
||||
const args = [
|
||||
'TS.CREATERULE',
|
||||
sourceKey,
|
||||
@@ -23,6 +25,6 @@ export function transformArguments(
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): 'OK';
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user