1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00
This commit is contained in:
Leibale
2023-05-10 12:08:02 +03:00
parent d59254e497
commit b4196faa41
12 changed files with 244 additions and 139 deletions

View File

@@ -6,27 +6,41 @@ describe('ZUNIONSTORE', () => {
describe('transformArguments', () => {
it('key (string)', () => {
assert.deepEqual(
ZUNIONSTORE.transformArguments('destination', 'key'),
ZUNIONSTORE.transformArguments('destination', 'source'),
['ZUNIONSTORE', 'destination', '1', 'key']
);
});
it('keys (array)', () => {
it('keys (Array<string>)', () => {
assert.deepEqual(
ZUNIONSTORE.transformArguments('destination', ['1', '2']),
['ZUNIONSTORE', 'destination', '2', '1', '2']
);
});
it('with WEIGHTS', () => {
it('key & weight', () => {
assert.deepEqual(
ZUNIONSTORE.transformArguments('destination', 'key', {
WEIGHTS: [1]
ZUNIONSTORE.transformArguments('destination', {
key: 'key',
weight: 1
}),
['ZUNIONSTORE', 'destination', '1', 'key', 'WEIGHTS', '1']
);
});
it('keys & weights', () => {
assert.deepEqual(
ZUNIONSTORE.transformArguments('destination', [{
key: 'a',
weight: 1
}, {
key: 'b',
weight: 2
}]),
['ZUNIONSTORE', 'destination', '2', 'a', 'b', 'WEIGHTS', '1', '2']
);
});
it('with AGGREGATE', () => {
assert.deepEqual(
ZUNIONSTORE.transformArguments('destination', 'key', {
@@ -35,16 +49,6 @@ describe('ZUNIONSTORE', () => {
['ZUNIONSTORE', 'destination', '1', 'key', 'AGGREGATE', 'SUM']
);
});
it('with WEIGHTS, AGGREGATE', () => {
assert.deepEqual(
ZUNIONSTORE.transformArguments('destination', 'key', {
WEIGHTS: [1],
AGGREGATE: 'SUM'
}),
['ZUNIONSTORE', 'destination', '1', 'key', 'WEIGHTS', '1', 'AGGREGATE', 'SUM']
);
});
});
testUtils.testAll('zUnionStore', async client => {