1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/client/lib/commands/XREVRANGE.spec.ts
2023-06-28 11:40:55 -04:00

40 lines
959 B
TypeScript

import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import XREVRANGE from './XREVRANGE';
describe('XREVRANGE', () => {
describe('transformArguments', () => {
it('simple', () => {
assert.deepEqual(
XREVRANGE.transformArguments('key', '-', '+'),
['XREVRANGE', 'key', '-', '+']
);
});
it('with COUNT', () => {
assert.deepEqual(
XREVRANGE.transformArguments('key', '-', '+', {
COUNT: 1
}),
['XREVRANGE', 'key', '-', '+', 'COUNT', '1']
);
});
});
testUtils.testAll('xRevRange', async client => {
const message = { field: 'value' },
[id, reply] = await Promise.all([
client.xAdd('key', '*', message),
client.xRevRange('key', '-', '+')
]);
assert.deepEqual(reply, [{
id,
message
}]);
}, {
client: GLOBAL.SERVERS.OPEN,
cluster: GLOBAL.CLUSTERS.OPEN
});
});