1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
This commit is contained in:
Leibale
2023-06-22 18:26:22 -04:00
parent 2b318d4100
commit 4a9d934b84
2 changed files with 37 additions and 6 deletions

View File

@@ -21,7 +21,27 @@ describe('SET', () => {
});
describe('expiration', () => {
it('with expiration', () => {
it('\'KEEPTTL\'', () => {
assert.deepEqual(
SET.transformArguments('key', 'value', {
expiration: 'KEEPTTL'
}),
['SET', 'key', 'value', 'KEEPTTL']
);
});
it('{ type: \'KEEPTTL\' }', () => {
assert.deepEqual(
SET.transformArguments('key', 'value', {
expiration: {
type: 'KEEPTTL'
}
}),
['SET', 'key', 'value', 'KEEPTTL']
);
});
it('{ type: \'EX\' }', () => {
assert.deepEqual(
SET.transformArguments('key', 'value', {
expiration: {

View File

@@ -13,11 +13,22 @@ describe('ZINTERCARD', () => {
);
});
it('with limit', () => {
assert.deepEqual(
ZINTERCARD.transformArguments(['1', '2'], 1),
['ZINTERCARD', '2', '1', '2', 'LIMIT', '1']
);
describe('with LIMIT', () => {
it('plain number (backwards compatibility)', () => {
assert.deepEqual(
ZINTERCARD.transformArguments(['1', '2'], 1),
['ZINTERCARD', '2', '1', '2', 'LIMIT', '1']
);
});
it('{ LIMIT: number }', () => {
assert.deepEqual(
ZINTERCARD.transformArguments(['1', '2'], {
LIMIT: 1
}),
['ZINTERCARD', '2', '1', '2', 'LIMIT', '1']
);
});
});
});