From ab3973aca3644efd2070b4b3acf7dc962d9d29fc Mon Sep 17 00:00:00 2001 From: Leibale Date: Thu, 27 Apr 2023 18:41:32 -0400 Subject: [PATCH] wip --- packages/client/lib/RESP/decoder.ts | 2 +- packages/client/lib/commands/SORT.ts | 1 - packages/client/lib/commands/SPOP.spec.ts | 50 ++-- packages/client/lib/commands/SPUBLISH.spec.ts | 33 ++- .../client/lib/commands/SRANDMEMBER.spec.ts | 29 +- .../lib/commands/SRANDMEMBER_COUNT.spec.ts | 29 +- .../client/lib/commands/SRANDMEMBER_COUNT.ts | 27 +- packages/client/lib/commands/SREM.spec.ts | 45 +-- packages/client/lib/commands/SSCAN.spec.ts | 108 +++---- packages/client/lib/commands/STRLEN.spec.ts | 36 +-- packages/client/lib/commands/SUNION.spec.ts | 50 ++-- .../client/lib/commands/SUNIONSTORE.spec.ts | 50 ++-- packages/client/lib/commands/SWAPDB.spec.ts | 34 +-- packages/client/lib/commands/SWAPDB.ts | 8 +- packages/client/lib/commands/TIME.spec.ts | 32 +- packages/client/lib/commands/TIME.ts | 26 +- packages/client/lib/commands/TOUCH.spec.ts | 45 +-- packages/client/lib/commands/TTL.spec.ts | 30 +- packages/client/lib/commands/TYPE.spec.ts | 29 +- packages/client/lib/commands/UNLINK.spec.ts | 45 +-- packages/client/lib/commands/UNWATCH.spec.ts | 26 +- packages/client/lib/commands/UNWATCH.ts | 5 +- packages/client/lib/commands/WAIT.spec.ts | 26 +- packages/client/lib/commands/WAIT.ts | 1 + packages/client/lib/commands/WATCH.spec.ts | 30 +- packages/client/lib/commands/WATCH.ts | 2 +- packages/client/lib/commands/XACK.spec.ts | 50 ++-- packages/client/lib/commands/XADD.spec.ts | 218 +++++++------- .../client/lib/commands/XAUTOCLAIM.spec.ts | 74 ++--- .../lib/commands/XAUTOCLAIM_JUSTID.spec.ts | 54 ++-- packages/client/lib/commands/XCLAIM.spec.ts | 160 +++++----- .../client/lib/commands/XCLAIM_JUSTID.spec.ts | 40 +-- packages/client/lib/commands/XDEL.spec.ts | 50 ++-- .../client/lib/commands/XGROUP_CREATE.spec.ts | 58 ++-- .../commands/XGROUP_CREATECONSUMER.spec.ts | 42 +-- .../lib/commands/XGROUP_DELCONSUMER.spec.ts | 40 +-- .../lib/commands/XGROUP_DESTROY.spec.ts | 40 +-- .../client/lib/commands/XGROUP_SETID.spec.ts | 40 +-- .../lib/commands/XINFO_CONSUMERS.spec.ts | 74 ++--- .../client/lib/commands/XINFO_GROUPS.spec.ts | 88 +++--- .../client/lib/commands/XINFO_STREAM.spec.ts | 136 ++++----- packages/client/lib/commands/XLEN.spec.ts | 29 +- packages/client/lib/commands/XPENDING.spec.ts | 114 +++---- .../lib/commands/XPENDING_RANGE.spec.ts | 94 +++--- packages/client/lib/commands/XRANGE.spec.ts | 54 ++-- packages/client/lib/commands/XREAD.spec.ts | 188 ++++++------ .../client/lib/commands/XREADGROUP.spec.ts | 278 +++++++++--------- .../client/lib/commands/XREVRANGE.spec.ts | 54 ++-- packages/client/lib/commands/XTRIM.spec.ts | 88 +++--- packages/client/lib/commands/index.ts | 36 +++ packages/test-utils/lib/index.ts | 2 +- 51 files changed, 1468 insertions(+), 1432 deletions(-) diff --git a/packages/client/lib/RESP/decoder.ts b/packages/client/lib/RESP/decoder.ts index 950387966e..49f04a2191 100644 --- a/packages/client/lib/RESP/decoder.ts +++ b/packages/client/lib/RESP/decoder.ts @@ -242,7 +242,7 @@ export class Decoder { private _maybeDecodeNumberValue(isNegative, chunk) { const cb = this._decodeUnsingedNumber.bind(this, 0); - return this._cursor === chunk.length ? + return ++this._cursor === chunk.length ? this._decodeNumberValue.bind(isNegative, cb) : this._decodeNumberValue(isNegative, cb, chunk); } diff --git a/packages/client/lib/commands/SORT.ts b/packages/client/lib/commands/SORT.ts index e04466cdf6..8d112e17e0 100644 --- a/packages/client/lib/commands/SORT.ts +++ b/packages/client/lib/commands/SORT.ts @@ -56,4 +56,3 @@ export default { transformArguments: transformSortArguments.bind(undefined, 'SORT'), transformReply: undefined as unknown as () => ArrayReply } as const satisfies Command; - diff --git a/packages/client/lib/commands/SPOP.spec.ts b/packages/client/lib/commands/SPOP.spec.ts index 6a384d181f..1800d08622 100644 --- a/packages/client/lib/commands/SPOP.spec.ts +++ b/packages/client/lib/commands/SPOP.spec.ts @@ -1,28 +1,28 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SPOP'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './SPOP'; -describe('SPOP', () => { - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key'), - ['SPOP', 'key'] - ); - }); +// describe('SPOP', () => { +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key'), +// ['SPOP', 'key'] +// ); +// }); - it('with count', () => { - assert.deepEqual( - transformArguments('key', 2), - ['SPOP', 'key', '2'] - ); - }); - }); +// it('with count', () => { +// assert.deepEqual( +// transformArguments('key', 2), +// ['SPOP', 'key', '2'] +// ); +// }); +// }); - testUtils.testWithClient('client.sPop', async client => { - assert.equal( - await client.sPop('key'), - null - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.sPop', async client => { +// assert.equal( +// await client.sPop('key'), +// null +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/SPUBLISH.spec.ts b/packages/client/lib/commands/SPUBLISH.spec.ts index 60b6ce2dad..0b1391774b 100644 --- a/packages/client/lib/commands/SPUBLISH.spec.ts +++ b/packages/client/lib/commands/SPUBLISH.spec.ts @@ -1,21 +1,24 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SPUBLISH'; +import SPUBLISH from './SPUBLISH'; describe('SPUBLISH', () => { - testUtils.isVersionGreaterThanHook([7]); - - it('transformArguments', () => { - assert.deepEqual( - transformArguments('channel', 'message'), - ['SPUBLISH', 'channel', 'message'] - ); - }); + testUtils.isVersionGreaterThanHook([7]); - testUtils.testWithClient('client.sPublish', async client => { - assert.equal( - await client.sPublish('channel', 'message'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); + it('transformArguments', () => { + assert.deepEqual( + SPUBLISH.transformArguments('channel', 'message'), + ['SPUBLISH', 'channel', 'message'] + ); + }); + + testUtils.testAll('sPublish', async client => { + assert.equal( + await client.sPublish('channel', 'message'), + 0 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/SRANDMEMBER.spec.ts b/packages/client/lib/commands/SRANDMEMBER.spec.ts index 291271540b..a0983e4480 100644 --- a/packages/client/lib/commands/SRANDMEMBER.spec.ts +++ b/packages/client/lib/commands/SRANDMEMBER.spec.ts @@ -1,19 +1,22 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SRANDMEMBER'; +import SRANDMEMBER from './SRANDMEMBER'; describe('SRANDMEMBER', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['SRANDMEMBER', 'key'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + SRANDMEMBER.transformArguments('key'), + ['SRANDMEMBER', 'key'] + ); + }); - testUtils.testWithClient('client.sRandMember', async client => { - assert.equal( - await client.sRandMember('key'), - null - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testAll('sRandMember', async client => { + assert.equal( + await client.sRandMember('key'), + null + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/SRANDMEMBER_COUNT.spec.ts b/packages/client/lib/commands/SRANDMEMBER_COUNT.spec.ts index d3d787b3e6..6ed30cd14a 100644 --- a/packages/client/lib/commands/SRANDMEMBER_COUNT.spec.ts +++ b/packages/client/lib/commands/SRANDMEMBER_COUNT.spec.ts @@ -1,19 +1,22 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SRANDMEMBER_COUNT'; +import SRANDMEMBER_COUNT from './SRANDMEMBER_COUNT'; describe('SRANDMEMBER COUNT', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 1), - ['SRANDMEMBER', 'key', '1'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + SRANDMEMBER_COUNT.transformArguments('key', 1), + ['SRANDMEMBER', 'key', '1'] + ); + }); - testUtils.testWithClient('client.sRandMemberCount', async client => { - assert.deepEqual( - await client.sRandMemberCount('key', 1), - [] - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testAll('sRandMemberCount', async client => { + assert.deepEqual( + await client.sRandMemberCount('key', 1), + [] + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/SRANDMEMBER_COUNT.ts b/packages/client/lib/commands/SRANDMEMBER_COUNT.ts index 54c3e96f23..778f3d8f62 100644 --- a/packages/client/lib/commands/SRANDMEMBER_COUNT.ts +++ b/packages/client/lib/commands/SRANDMEMBER_COUNT.ts @@ -1,16 +1,13 @@ -// import { RedisCommandArgument, RedisCommandArguments } from '.'; -// import { transformArguments as transformSRandMemberArguments } from './SRANDMEMBER'; +import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; +import SRANDMEMBER from './SRANDMEMBER'; -// export { FIRST_KEY_INDEX } from './SRANDMEMBER'; - -// export function transformArguments( -// key: RedisCommandArgument, -// count: number -// ): RedisCommandArguments { -// return [ -// ...transformSRandMemberArguments(key), -// count.toString() -// ]; -// } - -// export declare function transformReply(): Array; +export default { + FIRST_KEY_INDEX: SRANDMEMBER.FIRST_KEY_INDEX, + IS_READ_ONLY: SRANDMEMBER.IS_READ_ONLY, + transformArguments(key: RedisArgument, count: number) { + const args = SRANDMEMBER.transformArguments(key); + args.push(count.toString()); + return args; + }, + transformReply: undefined as unknown as () => ArrayReply +} as const satisfies Command; diff --git a/packages/client/lib/commands/SREM.spec.ts b/packages/client/lib/commands/SREM.spec.ts index d53d7b0334..8df39102bc 100644 --- a/packages/client/lib/commands/SREM.spec.ts +++ b/packages/client/lib/commands/SREM.spec.ts @@ -1,28 +1,31 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SREM'; +import SREM from './SREM'; describe('SREM', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key', 'member'), - ['SREM', 'key', 'member'] - ); - }); - - it('array', () => { - assert.deepEqual( - transformArguments('key', ['1', '2']), - ['SREM', 'key', '1', '2'] - ); - }); + describe('transformArguments', () => { + it('string', () => { + assert.deepEqual( + SREM.transformArguments('key', 'member'), + ['SREM', 'key', 'member'] + ); }); - testUtils.testWithClient('client.sRem', async client => { - assert.equal( - await client.sRem('key', 'member'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); + it('array', () => { + assert.deepEqual( + SREM.transformArguments('key', ['1', '2']), + ['SREM', 'key', '1', '2'] + ); + }); + }); + + testUtils.testAll('client.sRem', async client => { + assert.equal( + await client.sRem('key', 'member'), + 0 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/SSCAN.spec.ts b/packages/client/lib/commands/SSCAN.spec.ts index 71a90bf81d..4cfb59445d 100644 --- a/packages/client/lib/commands/SSCAN.spec.ts +++ b/packages/client/lib/commands/SSCAN.spec.ts @@ -1,74 +1,52 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments, transformReply } from './SSCAN'; +import SSCAN from './SSCAN'; describe('SSCAN', () => { - describe('transformArguments', () => { - it('cusror only', () => { - assert.deepEqual( - transformArguments('key', 0), - ['SSCAN', 'key', '0'] - ); - }); - - it('with MATCH', () => { - assert.deepEqual( - transformArguments('key', 0, { - MATCH: 'pattern' - }), - ['SSCAN', 'key', '0', 'MATCH', 'pattern'] - ); - }); - - it('with COUNT', () => { - assert.deepEqual( - transformArguments('key', 0, { - COUNT: 1 - }), - ['SSCAN', 'key', '0', 'COUNT', '1'] - ); - }); - - it('with MATCH & COUNT', () => { - assert.deepEqual( - transformArguments('key', 0, { - MATCH: 'pattern', - COUNT: 1 - }), - ['SSCAN', 'key', '0', 'MATCH', 'pattern', 'COUNT', '1'] - ); - }); + describe('transformArguments', () => { + it('cusror only', () => { + assert.deepEqual( + SSCAN.transformArguments('key', 0), + ['SSCAN', 'key', '0'] + ); }); - describe('transformReply', () => { - it('without members', () => { - assert.deepEqual( - transformReply(['0', []]), - { - cursor: 0, - members: [] - } - ); - }); - - it('with members', () => { - assert.deepEqual( - transformReply(['0', ['member']]), - { - cursor: 0, - members: ['member'] - } - ); - }); + it('with MATCH', () => { + assert.deepEqual( + SSCAN.transformArguments('key', 0, { + MATCH: 'pattern' + }), + ['SSCAN', 'key', '0', 'MATCH', 'pattern'] + ); }); - testUtils.testWithClient('client.sScan', async client => { - assert.deepEqual( - await client.sScan('key', 0), - { - cursor: 0, - members: [] - } - ); - }, GLOBAL.SERVERS.OPEN); + it('with COUNT', () => { + assert.deepEqual( + SSCAN.transformArguments('key', 0, { + COUNT: 1 + }), + ['SSCAN', 'key', '0', 'COUNT', '1'] + ); + }); + + it('with MATCH & COUNT', () => { + assert.deepEqual( + SSCAN.transformArguments('key', 0, { + MATCH: 'pattern', + COUNT: 1 + }), + ['SSCAN', 'key', '0', 'MATCH', 'pattern', 'COUNT', '1'] + ); + }); + }); + + testUtils.testWithClient('client.sScan', async client => { + assert.deepEqual( + await client.sScan('key', 0), + { + cursor: 0, + members: [] + } + ); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/packages/client/lib/commands/STRLEN.spec.ts b/packages/client/lib/commands/STRLEN.spec.ts index 519c68d3e5..b80a84a010 100644 --- a/packages/client/lib/commands/STRLEN.spec.ts +++ b/packages/client/lib/commands/STRLEN.spec.ts @@ -1,26 +1,22 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './STRLEN'; +import STRLEN from './STRLEN'; describe('STRLEN', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['STRLEN', 'key'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + STRLEN.transformArguments('key'), + ['STRLEN', 'key'] + ); + }); - testUtils.testWithClient('client.strLen', async client => { - assert.equal( - await client.strLen('key'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); - - testUtils.testWithCluster('cluster.strLen', async cluster => { - assert.equal( - await cluster.strLen('key'), - 0 - ); - }, GLOBAL.CLUSTERS.OPEN); + testUtils.testAll('strLen', async client => { + assert.equal( + await client.strLen('key'), + 0 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/SUNION.spec.ts b/packages/client/lib/commands/SUNION.spec.ts index 2918607c1d..b0ddf782f9 100644 --- a/packages/client/lib/commands/SUNION.spec.ts +++ b/packages/client/lib/commands/SUNION.spec.ts @@ -1,28 +1,28 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SUNION'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './SUNION'; -describe('SUNION', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key'), - ['SUNION', 'key'] - ); - }); +// describe('SUNION', () => { +// describe('transformArguments', () => { +// it('string', () => { +// assert.deepEqual( +// transformArguments('key'), +// ['SUNION', 'key'] +// ); +// }); - it('array', () => { - assert.deepEqual( - transformArguments(['1', '2']), - ['SUNION', '1', '2'] - ); - }); - }); +// it('array', () => { +// assert.deepEqual( +// transformArguments(['1', '2']), +// ['SUNION', '1', '2'] +// ); +// }); +// }); - testUtils.testWithClient('client.sUnion', async client => { - assert.deepEqual( - await client.sUnion('key'), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.sUnion', async client => { +// assert.deepEqual( +// await client.sUnion('key'), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/SUNIONSTORE.spec.ts b/packages/client/lib/commands/SUNIONSTORE.spec.ts index 142533eea2..4cf50132aa 100644 --- a/packages/client/lib/commands/SUNIONSTORE.spec.ts +++ b/packages/client/lib/commands/SUNIONSTORE.spec.ts @@ -1,28 +1,28 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SUNIONSTORE'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './SUNIONSTORE'; -describe('SUNIONSTORE', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('destination', 'key'), - ['SUNIONSTORE', 'destination', 'key'] - ); - }); +// describe('SUNIONSTORE', () => { +// describe('transformArguments', () => { +// it('string', () => { +// assert.deepEqual( +// transformArguments('destination', 'key'), +// ['SUNIONSTORE', 'destination', 'key'] +// ); +// }); - it('array', () => { - assert.deepEqual( - transformArguments('destination', ['1', '2']), - ['SUNIONSTORE', 'destination', '1', '2'] - ); - }); - }); +// it('array', () => { +// assert.deepEqual( +// transformArguments('destination', ['1', '2']), +// ['SUNIONSTORE', 'destination', '1', '2'] +// ); +// }); +// }); - testUtils.testWithClient('client.sUnionStore', async client => { - assert.equal( - await client.sUnionStore('destination', 'key'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.sUnionStore', async client => { +// assert.equal( +// await client.sUnionStore('destination', 'key'), +// 0 +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/SWAPDB.spec.ts b/packages/client/lib/commands/SWAPDB.spec.ts index add87512a6..dee881b5dc 100644 --- a/packages/client/lib/commands/SWAPDB.spec.ts +++ b/packages/client/lib/commands/SWAPDB.spec.ts @@ -1,19 +1,19 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './SWAPDB'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './SWAPDB'; -describe('SWAPDB', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments(0, 1), - ['SWAPDB', '0', '1'] - ); - }); +// describe('SWAPDB', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments(0, 1), +// ['SWAPDB', '0', '1'] +// ); +// }); - testUtils.testWithClient('client.swapDb', async client => { - assert.equal( - await client.swapDb(0, 1), - 'OK' - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.swapDb', async client => { +// assert.equal( +// await client.swapDb(0, 1), +// 'OK' +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/SWAPDB.ts b/packages/client/lib/commands/SWAPDB.ts index 7f13d6b008..0ab785fb59 100644 --- a/packages/client/lib/commands/SWAPDB.ts +++ b/packages/client/lib/commands/SWAPDB.ts @@ -1,5 +1,5 @@ -export function transformArguments(index1: number, index2: number): Array { - return ['SWAPDB', index1.toString(), index2.toString()]; -} +// export function transformArguments(index1: number, index2: number): Array { +// return ['SWAPDB', index1.toString(), index2.toString()]; +// } -export declare function transformReply(): string; +// export declare function transformReply(): string; diff --git a/packages/client/lib/commands/TIME.spec.ts b/packages/client/lib/commands/TIME.spec.ts index bbaa7942db..5bfd1e50d9 100644 --- a/packages/client/lib/commands/TIME.spec.ts +++ b/packages/client/lib/commands/TIME.spec.ts @@ -1,18 +1,18 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './TIME'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './TIME'; -describe('TIME', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments(), - ['TIME'] - ); - }); +// describe('TIME', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments(), +// ['TIME'] +// ); +// }); - testUtils.testWithClient('client.time', async client => { - const reply = await client.time(); - assert.ok(reply instanceof Date); - assert.ok(typeof reply.microseconds === 'number'); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.time', async client => { +// const reply = await client.time(); +// assert.ok(reply instanceof Date); +// assert.ok(typeof reply.microseconds === 'number'); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/TIME.ts b/packages/client/lib/commands/TIME.ts index 1a364d6d8b..298a4d5aee 100644 --- a/packages/client/lib/commands/TIME.ts +++ b/packages/client/lib/commands/TIME.ts @@ -1,15 +1,15 @@ -export function transformArguments(): Array { - return ['TIME']; -} +// export function transformArguments(): Array { +// return ['TIME']; +// } -interface TimeReply extends Date { - microseconds: number; -} +// interface TimeReply extends Date { +// microseconds: number; +// } -export function transformReply(reply: [string, string]): TimeReply { - const seconds = Number(reply[0]), - microseconds = Number(reply[1]), - d: Partial = new Date(seconds * 1000 + microseconds / 1000); - d.microseconds = microseconds; - return d as TimeReply; -} +// export function transformReply(reply: [string, string]): TimeReply { +// const seconds = Number(reply[0]), +// microseconds = Number(reply[1]), +// d: Partial = new Date(seconds * 1000 + microseconds / 1000); +// d.microseconds = microseconds; +// return d as TimeReply; +// } diff --git a/packages/client/lib/commands/TOUCH.spec.ts b/packages/client/lib/commands/TOUCH.spec.ts index 578c49587d..01c5ed9454 100644 --- a/packages/client/lib/commands/TOUCH.spec.ts +++ b/packages/client/lib/commands/TOUCH.spec.ts @@ -1,28 +1,31 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './TOUCH'; +import TOUCH from './TOUCH'; describe('TOUCH', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key'), - ['TOUCH', 'key'] - ); - }); - - it('array', () => { - assert.deepEqual( - transformArguments(['1', '2']), - ['TOUCH', '1', '2'] - ); - }); + describe('transformArguments', () => { + it('string', () => { + assert.deepEqual( + TOUCH.transformArguments('key'), + ['TOUCH', 'key'] + ); }); - testUtils.testWithClient('client.touch', async client => { - assert.equal( - await client.touch('key'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); + it('array', () => { + assert.deepEqual( + TOUCH.transformArguments(['1', '2']), + ['TOUCH', '1', '2'] + ); + }); + }); + + testUtils.testAll('touch', async client => { + assert.equal( + await client.touch('key'), + 0 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/TTL.spec.ts b/packages/client/lib/commands/TTL.spec.ts index e37a6ab714..05c75851ee 100644 --- a/packages/client/lib/commands/TTL.spec.ts +++ b/packages/client/lib/commands/TTL.spec.ts @@ -1,19 +1,23 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './TTL'; +import TTL from './TTL'; describe('TTL', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['TTL', 'key'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + TTL.transformArguments('key'), + ['TTL', 'key'] + ); + }); - testUtils.testWithClient('client.ttl', async client => { - assert.equal( - await client.ttl('key'), - -2 - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testAll('ttl', async client => { + console.log(await client.get('key'), await client.ttl('key')); + assert.equal( + await client.ttl('key'), + -2 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/TYPE.spec.ts b/packages/client/lib/commands/TYPE.spec.ts index 1040bf979b..01beef42e1 100644 --- a/packages/client/lib/commands/TYPE.spec.ts +++ b/packages/client/lib/commands/TYPE.spec.ts @@ -1,19 +1,22 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './TYPE'; +import TYPE from './TYPE'; describe('TYPE', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['TYPE', 'key'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + TYPE.transformArguments('key'), + ['TYPE', 'key'] + ); + }); - testUtils.testWithClient('client.type', async client => { - assert.equal( - await client.type('key'), - 'none' - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testAll('type', async client => { + assert.equal( + await client.type('key'), + 'none' + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/UNLINK.spec.ts b/packages/client/lib/commands/UNLINK.spec.ts index e8355407d8..726c05223a 100644 --- a/packages/client/lib/commands/UNLINK.spec.ts +++ b/packages/client/lib/commands/UNLINK.spec.ts @@ -1,28 +1,31 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './UNLINK'; +import UNLINK from './UNLINK'; describe('UNLINK', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key'), - ['UNLINK', 'key'] - ); - }); - - it('array', () => { - assert.deepEqual( - transformArguments(['1', '2']), - ['UNLINK', '1', '2'] - ); - }); + describe('transformArguments', () => { + it('string', () => { + assert.deepEqual( + UNLINK.transformArguments('key'), + ['UNLINK', 'key'] + ); }); - testUtils.testWithClient('client.unlink', async client => { - assert.equal( - await client.unlink('key'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); + it('array', () => { + assert.deepEqual( + UNLINK.transformArguments(['1', '2']), + ['UNLINK', '1', '2'] + ); + }); + }); + + testUtils.testAll('unlink', async client => { + assert.equal( + await client.unlink('key'), + 0 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/UNWATCH.spec.ts b/packages/client/lib/commands/UNWATCH.spec.ts index 109ed0fa7c..75bac71d85 100644 --- a/packages/client/lib/commands/UNWATCH.spec.ts +++ b/packages/client/lib/commands/UNWATCH.spec.ts @@ -1,19 +1,19 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './UNWATCH'; +import UNWATCH from './UNWATCH'; describe('UNWATCH', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments(), - ['UNWATCH'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + UNWATCH.transformArguments(), + ['UNWATCH'] + ); + }); - testUtils.testWithClient('client.unwatch', async client => { - assert.equal( - await client.unwatch(), - 'OK' - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testWithClient('client.unwatch', async client => { + assert.equal( + await client.unwatch(), + 'OK' + ); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/packages/client/lib/commands/UNWATCH.ts b/packages/client/lib/commands/UNWATCH.ts index 3e80adeb1d..9dd83b9aee 100644 --- a/packages/client/lib/commands/UNWATCH.ts +++ b/packages/client/lib/commands/UNWATCH.ts @@ -1,9 +1,10 @@ import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; export default { + FIRST_KEY_INDEX: undefined, IS_READ_ONLY: true, - transformArguments(key: RedisArgument) { - return ['WATCH', key]; + transformArguments() { + return ['UNWATCH']; }, transformReply: undefined as unknown as () => SimpleStringReply } as const satisfies Command; diff --git a/packages/client/lib/commands/WAIT.spec.ts b/packages/client/lib/commands/WAIT.spec.ts index c85ef59861..8a8fb3a36c 100644 --- a/packages/client/lib/commands/WAIT.spec.ts +++ b/packages/client/lib/commands/WAIT.spec.ts @@ -1,19 +1,19 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './WAIT'; +import WAIT from './WAIT'; describe('WAIT', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments(0, 1), - ['WAIT', '0', '1'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + WAIT.transformArguments(0, 1), + ['WAIT', '0', '1'] + ); + }); - testUtils.testWithClient('client.wait', async client => { - assert.equal( - await client.wait(0, 1), - 0 - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testWithClient('client.wait', async client => { + assert.equal( + await client.wait(0, 1), + 0 + ); + }, GLOBAL.SERVERS.OPEN); }); diff --git a/packages/client/lib/commands/WAIT.ts b/packages/client/lib/commands/WAIT.ts index da9df89ff0..5c4bd156a6 100644 --- a/packages/client/lib/commands/WAIT.ts +++ b/packages/client/lib/commands/WAIT.ts @@ -1,6 +1,7 @@ import { RedisArgument, SimpleStringReply, Command, NumberReply } from '../RESP/types'; export default { + FIRST_KEY_INDEX: undefined, IS_READ_ONLY: true, transformArguments(numberOfReplicas: number, timeout: number) { return ['WAIT', numberOfReplicas.toString(), timeout.toString()]; diff --git a/packages/client/lib/commands/WATCH.spec.ts b/packages/client/lib/commands/WATCH.spec.ts index acaa062874..d533a0b3e1 100644 --- a/packages/client/lib/commands/WATCH.spec.ts +++ b/packages/client/lib/commands/WATCH.spec.ts @@ -1,20 +1,20 @@ import { strict as assert } from 'assert'; -import { transformArguments } from './WATCH'; +import WATCH from './WATCH'; describe('WATCH', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key'), - ['WATCH', 'key'] - ); - }); - - it('array', () => { - assert.deepEqual( - transformArguments(['1', '2']), - ['WATCH', '1', '2'] - ); - }); + describe('transformArguments', () => { + it('string', () => { + assert.deepEqual( + WATCH.transformArguments('key'), + ['WATCH', 'key'] + ); }); + + it('array', () => { + assert.deepEqual( + WATCH.transformArguments(['1', '2']), + ['WATCH', '1', '2'] + ); + }); + }); }); diff --git a/packages/client/lib/commands/WATCH.ts b/packages/client/lib/commands/WATCH.ts index b4fd86b37a..339642bf99 100644 --- a/packages/client/lib/commands/WATCH.ts +++ b/packages/client/lib/commands/WATCH.ts @@ -2,7 +2,7 @@ import { SimpleStringReply, Command } from '../RESP/types'; import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers'; export default { - FIRST_KEY_INDEX: 1, + FIRST_KEY_INDEX: undefined, IS_READ_ONLY: true, transformArguments(key: RedisVariadicArgument) { return pushVariadicArguments(['WATCH'], key); diff --git a/packages/client/lib/commands/XACK.spec.ts b/packages/client/lib/commands/XACK.spec.ts index 0586a5921f..fdfaee5fb5 100644 --- a/packages/client/lib/commands/XACK.spec.ts +++ b/packages/client/lib/commands/XACK.spec.ts @@ -1,28 +1,28 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XACK'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XACK'; -describe('XACK', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key', 'group', '1-0'), - ['XACK', 'key', 'group', '1-0'] - ); - }); +// describe('XACK', () => { +// describe('transformArguments', () => { +// it('string', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '1-0'), +// ['XACK', 'key', 'group', '1-0'] +// ); +// }); - it('array', () => { - assert.deepEqual( - transformArguments('key', 'group', ['1-0', '2-0']), - ['XACK', 'key', 'group', '1-0', '2-0'] - ); - }); - }); +// it('array', () => { +// assert.deepEqual( +// transformArguments('key', 'group', ['1-0', '2-0']), +// ['XACK', 'key', 'group', '1-0', '2-0'] +// ); +// }); +// }); - testUtils.testWithClient('client.xAck', async client => { - assert.equal( - await client.xAck('key', 'group', '1-0'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xAck', async client => { +// assert.equal( +// await client.xAck('key', 'group', '1-0'), +// 0 +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XADD.spec.ts b/packages/client/lib/commands/XADD.spec.ts index 4b556ecc27..c2b9c4f7bb 100644 --- a/packages/client/lib/commands/XADD.spec.ts +++ b/packages/client/lib/commands/XADD.spec.ts @@ -1,118 +1,118 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XADD'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XADD'; -describe('XADD', () => { - describe('transformArguments', () => { - it('single field', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }), - ['XADD', 'key', '*', 'field', 'value'] - ); - }); +// describe('XADD', () => { +// describe('transformArguments', () => { +// it('single field', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }), +// ['XADD', 'key', '*', 'field', 'value'] +// ); +// }); - it('multiple fields', () => { - assert.deepEqual( - transformArguments('key', '*', { - '1': 'I', - '2': 'II' - }), - ['XADD', 'key', '*', '1', 'I', '2', 'II'] - ); - }); +// it('multiple fields', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// '1': 'I', +// '2': 'II' +// }), +// ['XADD', 'key', '*', '1', 'I', '2', 'II'] +// ); +// }); - it('with NOMKSTREAM', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }, { - NOMKSTREAM: true - }), - ['XADD', 'key', 'NOMKSTREAM', '*', 'field', 'value'] - ); - }); +// it('with NOMKSTREAM', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }, { +// NOMKSTREAM: true +// }), +// ['XADD', 'key', 'NOMKSTREAM', '*', 'field', 'value'] +// ); +// }); - it('with TRIM', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }, { - TRIM: { - threshold: 1000 - } - }), - ['XADD', 'key', '1000', '*', 'field', 'value'] - ); - }); +// it('with TRIM', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }, { +// TRIM: { +// threshold: 1000 +// } +// }), +// ['XADD', 'key', '1000', '*', 'field', 'value'] +// ); +// }); - it('with TRIM.strategy', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }, { - TRIM: { - strategy: 'MAXLEN', - threshold: 1000 - } - }), - ['XADD', 'key', 'MAXLEN', '1000', '*','field', 'value'] - ); - }); +// it('with TRIM.strategy', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }, { +// TRIM: { +// strategy: 'MAXLEN', +// threshold: 1000 +// } +// }), +// ['XADD', 'key', 'MAXLEN', '1000', '*','field', 'value'] +// ); +// }); - it('with TRIM.strategyModifier', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }, { - TRIM: { - strategyModifier: '=', - threshold: 1000 - } - }), - ['XADD', 'key', '=', '1000', '*', 'field', 'value'] - ); - }); +// it('with TRIM.strategyModifier', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }, { +// TRIM: { +// strategyModifier: '=', +// threshold: 1000 +// } +// }), +// ['XADD', 'key', '=', '1000', '*', 'field', 'value'] +// ); +// }); - it('with TRIM.limit', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }, { - TRIM: { - threshold: 1000, - limit: 1 - } - }), - ['XADD', 'key', '1000', 'LIMIT', '1', '*', 'field', 'value'] - ); - }); +// it('with TRIM.limit', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }, { +// TRIM: { +// threshold: 1000, +// limit: 1 +// } +// }), +// ['XADD', 'key', '1000', 'LIMIT', '1', '*', 'field', 'value'] +// ); +// }); - it('with NOMKSTREAM, TRIM, TRIM.*', () => { - assert.deepEqual( - transformArguments('key', '*', { - field: 'value' - }, { - NOMKSTREAM: true, - TRIM: { - strategy: 'MAXLEN', - strategyModifier: '=', - threshold: 1000, - limit: 1 - } - }), - ['XADD', 'key', 'NOMKSTREAM', 'MAXLEN', '=', '1000', 'LIMIT', '1', '*', 'field', 'value'] - ); - }); - }); +// it('with NOMKSTREAM, TRIM, TRIM.*', () => { +// assert.deepEqual( +// transformArguments('key', '*', { +// field: 'value' +// }, { +// NOMKSTREAM: true, +// TRIM: { +// strategy: 'MAXLEN', +// strategyModifier: '=', +// threshold: 1000, +// limit: 1 +// } +// }), +// ['XADD', 'key', 'NOMKSTREAM', 'MAXLEN', '=', '1000', 'LIMIT', '1', '*', 'field', 'value'] +// ); +// }); +// }); - testUtils.testWithClient('client.xAdd', async client => { - assert.equal( - typeof await client.xAdd('key', '*', { - field: 'value' - }), - 'string' - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xAdd', async client => { +// assert.equal( +// typeof await client.xAdd('key', '*', { +// field: 'value' +// }), +// 'string' +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XAUTOCLAIM.spec.ts b/packages/client/lib/commands/XAUTOCLAIM.spec.ts index 4447a06d77..80382db8d2 100644 --- a/packages/client/lib/commands/XAUTOCLAIM.spec.ts +++ b/packages/client/lib/commands/XAUTOCLAIM.spec.ts @@ -1,42 +1,42 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XAUTOCLAIM'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XAUTOCLAIM'; -describe('XAUTOCLAIM', () => { - testUtils.isVersionGreaterThanHook([6, 2]); +// describe('XAUTOCLAIM', () => { +// testUtils.isVersionGreaterThanHook([6, 2]); - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0'), - ['XAUTOCLAIM', 'key', 'group', 'consumer', '1', '0-0'] - ); - }); +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0'), +// ['XAUTOCLAIM', 'key', 'group', 'consumer', '1', '0-0'] +// ); +// }); - it('with COUNT', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - COUNT: 1 - }), - ['XAUTOCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'COUNT', '1'] - ); - }); - }); +// it('with COUNT', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// COUNT: 1 +// }), +// ['XAUTOCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'COUNT', '1'] +// ); +// }); +// }); - testUtils.testWithClient('client.xAutoClaim', async client => { - await Promise.all([ - client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - client.xGroupCreateConsumer('key', 'group', 'consumer'), - ]); +// testUtils.testWithClient('client.xAutoClaim', async client => { +// await Promise.all([ +// client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// client.xGroupCreateConsumer('key', 'group', 'consumer'), +// ]); - assert.deepEqual( - await client.xAutoClaim('key', 'group', 'consumer', 1, '0-0'), - { - nextId: '0-0', - messages: [] - } - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xAutoClaim('key', 'group', 'consumer', 1, '0-0'), +// { +// nextId: '0-0', +// messages: [] +// } +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XAUTOCLAIM_JUSTID.spec.ts b/packages/client/lib/commands/XAUTOCLAIM_JUSTID.spec.ts index 9aa24cd04a..ed7b80cabf 100644 --- a/packages/client/lib/commands/XAUTOCLAIM_JUSTID.spec.ts +++ b/packages/client/lib/commands/XAUTOCLAIM_JUSTID.spec.ts @@ -1,31 +1,31 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XAUTOCLAIM_JUSTID'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XAUTOCLAIM_JUSTID'; -describe('XAUTOCLAIM JUSTID', () => { - testUtils.isVersionGreaterThanHook([6, 2]); +// describe('XAUTOCLAIM JUSTID', () => { +// testUtils.isVersionGreaterThanHook([6, 2]); - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0'), - ['XAUTOCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'JUSTID'] - ); - }); +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0'), +// ['XAUTOCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'JUSTID'] +// ); +// }); - testUtils.testWithClient('client.xAutoClaimJustId', async client => { - await Promise.all([ - client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - client.xGroupCreateConsumer('key', 'group', 'consumer'), - ]); +// testUtils.testWithClient('client.xAutoClaimJustId', async client => { +// await Promise.all([ +// client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// client.xGroupCreateConsumer('key', 'group', 'consumer'), +// ]); - assert.deepEqual( - await client.xAutoClaimJustId('key', 'group', 'consumer', 1, '0-0'), - { - nextId: '0-0', - messages: [] - } - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xAutoClaimJustId('key', 'group', 'consumer', 1, '0-0'), +// { +// nextId: '0-0', +// messages: [] +// } +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XCLAIM.spec.ts b/packages/client/lib/commands/XCLAIM.spec.ts index 141a62ab77..a9f6879cfa 100644 --- a/packages/client/lib/commands/XCLAIM.spec.ts +++ b/packages/client/lib/commands/XCLAIM.spec.ts @@ -1,90 +1,90 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XCLAIM'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XCLAIM'; -describe('XCLAIM', () => { - describe('transformArguments', () => { - it('single id (string)', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0'), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0'] - ); - }); +// describe('XCLAIM', () => { +// describe('transformArguments', () => { +// it('single id (string)', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0'), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0'] +// ); +// }); - it('multiple ids (array)', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, ['0-0', '1-0']), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', '1-0'] - ); - }); +// it('multiple ids (array)', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, ['0-0', '1-0']), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', '1-0'] +// ); +// }); - it('with IDLE', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - IDLE: 1 - }), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'IDLE', '1'] - ); - }); +// it('with IDLE', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// IDLE: 1 +// }), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'IDLE', '1'] +// ); +// }); - it('with TIME (number)', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - TIME: 1 - }), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'TIME', '1'] - ); - }); +// it('with TIME (number)', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// TIME: 1 +// }), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'TIME', '1'] +// ); +// }); - it('with TIME (date)', () => { - const d = new Date(); - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - TIME: d - }), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'TIME', d.getTime().toString()] - ); - }); +// it('with TIME (date)', () => { +// const d = new Date(); +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// TIME: d +// }), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'TIME', d.getTime().toString()] +// ); +// }); - it('with RETRYCOUNT', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - RETRYCOUNT: 1 - }), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'RETRYCOUNT', '1'] - ); - }); +// it('with RETRYCOUNT', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// RETRYCOUNT: 1 +// }), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'RETRYCOUNT', '1'] +// ); +// }); - it('with FORCE', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - FORCE: true - }), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'FORCE'] - ); - }); +// it('with FORCE', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// FORCE: true +// }), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'FORCE'] +// ); +// }); - it('with IDLE, TIME, RETRYCOUNT, FORCE, JUSTID', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0', { - IDLE: 1, - TIME: 1, - RETRYCOUNT: 1, - FORCE: true - }), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'IDLE', '1', 'TIME', '1', 'RETRYCOUNT', '1', 'FORCE'] - ); - }); - }); +// it('with IDLE, TIME, RETRYCOUNT, FORCE, JUSTID', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0', { +// IDLE: 1, +// TIME: 1, +// RETRYCOUNT: 1, +// FORCE: true +// }), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'IDLE', '1', 'TIME', '1', 'RETRYCOUNT', '1', 'FORCE'] +// ); +// }); +// }); - testUtils.testWithClient('client.xClaim', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xClaim', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xClaim('key', 'group', 'consumer', 1, '0-0'), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xClaim('key', 'group', 'consumer', 1, '0-0'), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XCLAIM_JUSTID.spec.ts b/packages/client/lib/commands/XCLAIM_JUSTID.spec.ts index 619f876d53..88fe59084b 100644 --- a/packages/client/lib/commands/XCLAIM_JUSTID.spec.ts +++ b/packages/client/lib/commands/XCLAIM_JUSTID.spec.ts @@ -1,23 +1,23 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XCLAIM_JUSTID'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XCLAIM_JUSTID'; -describe('XCLAIM JUSTID', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer', 1, '0-0'), - ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'JUSTID'] - ); - }); +// describe('XCLAIM JUSTID', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer', 1, '0-0'), +// ['XCLAIM', 'key', 'group', 'consumer', '1', '0-0', 'JUSTID'] +// ); +// }); - testUtils.testWithClient('client.xClaimJustId', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xClaimJustId', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xClaimJustId('key', 'group', 'consumer', 1, '0-0'), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xClaimJustId('key', 'group', 'consumer', 1, '0-0'), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XDEL.spec.ts b/packages/client/lib/commands/XDEL.spec.ts index 00f9e2f9c6..4f7d48aa0e 100644 --- a/packages/client/lib/commands/XDEL.spec.ts +++ b/packages/client/lib/commands/XDEL.spec.ts @@ -1,28 +1,28 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XDEL'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XDEL'; -describe('XDEL', () => { - describe('transformArguments', () => { - it('string', () => { - assert.deepEqual( - transformArguments('key', '0-0'), - ['XDEL', 'key', '0-0'] - ); - }); +// describe('XDEL', () => { +// describe('transformArguments', () => { +// it('string', () => { +// assert.deepEqual( +// transformArguments('key', '0-0'), +// ['XDEL', 'key', '0-0'] +// ); +// }); - it('array', () => { - assert.deepEqual( - transformArguments('key', ['0-0', '1-0']), - ['XDEL', 'key', '0-0', '1-0'] - ); - }); - }); +// it('array', () => { +// assert.deepEqual( +// transformArguments('key', ['0-0', '1-0']), +// ['XDEL', 'key', '0-0', '1-0'] +// ); +// }); +// }); - testUtils.testWithClient('client.xDel', async client => { - assert.equal( - await client.xDel('key', '0-0'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xDel', async client => { +// assert.equal( +// await client.xDel('key', '0-0'), +// 0 +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XGROUP_CREATE.spec.ts b/packages/client/lib/commands/XGROUP_CREATE.spec.ts index 57516e44cc..831db73e68 100644 --- a/packages/client/lib/commands/XGROUP_CREATE.spec.ts +++ b/packages/client/lib/commands/XGROUP_CREATE.spec.ts @@ -1,32 +1,32 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XGROUP_CREATE'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XGROUP_CREATE'; -describe('XGROUP CREATE', () => { - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key', 'group', '$'), - ['XGROUP', 'CREATE', 'key', 'group', '$'] - ); - }); +// describe('XGROUP CREATE', () => { +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '$'), +// ['XGROUP', 'CREATE', 'key', 'group', '$'] +// ); +// }); - it('with MKSTREAM', () => { - assert.deepEqual( - transformArguments('key', 'group', '$', { - MKSTREAM: true - }), - ['XGROUP', 'CREATE', 'key', 'group', '$', 'MKSTREAM'] - ); - }); - }); +// it('with MKSTREAM', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '$', { +// MKSTREAM: true +// }), +// ['XGROUP', 'CREATE', 'key', 'group', '$', 'MKSTREAM'] +// ); +// }); +// }); - testUtils.testWithClient('client.xGroupCreate', async client => { - assert.equal( - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - 'OK' - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xGroupCreate', async client => { +// assert.equal( +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// 'OK' +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XGROUP_CREATECONSUMER.spec.ts b/packages/client/lib/commands/XGROUP_CREATECONSUMER.spec.ts index 6244334518..1338b8837a 100644 --- a/packages/client/lib/commands/XGROUP_CREATECONSUMER.spec.ts +++ b/packages/client/lib/commands/XGROUP_CREATECONSUMER.spec.ts @@ -1,25 +1,25 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XGROUP_CREATECONSUMER'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XGROUP_CREATECONSUMER'; -describe('XGROUP CREATECONSUMER', () => { - testUtils.isVersionGreaterThanHook([6, 2]); +// describe('XGROUP CREATECONSUMER', () => { +// testUtils.isVersionGreaterThanHook([6, 2]); - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer'), - ['XGROUP', 'CREATECONSUMER', 'key', 'group', 'consumer'] - ); - }); +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer'), +// ['XGROUP', 'CREATECONSUMER', 'key', 'group', 'consumer'] +// ); +// }); - testUtils.testWithClient('client.xGroupCreateConsumer', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xGroupCreateConsumer', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.equal( - await client.xGroupCreateConsumer('key', 'group', 'consumer'), - true - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.equal( +// await client.xGroupCreateConsumer('key', 'group', 'consumer'), +// true +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XGROUP_DELCONSUMER.spec.ts b/packages/client/lib/commands/XGROUP_DELCONSUMER.spec.ts index d071aedf64..c1704b5619 100644 --- a/packages/client/lib/commands/XGROUP_DELCONSUMER.spec.ts +++ b/packages/client/lib/commands/XGROUP_DELCONSUMER.spec.ts @@ -1,23 +1,23 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XGROUP_DELCONSUMER'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XGROUP_DELCONSUMER'; -describe('XGROUP DELCONSUMER', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group', 'consumer'), - ['XGROUP', 'DELCONSUMER', 'key', 'group', 'consumer'] - ); - }); +// describe('XGROUP DELCONSUMER', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group', 'consumer'), +// ['XGROUP', 'DELCONSUMER', 'key', 'group', 'consumer'] +// ); +// }); - testUtils.testWithClient('client.xGroupDelConsumer', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xGroupDelConsumer', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.equal( - await client.xGroupDelConsumer('key', 'group', 'consumer'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.equal( +// await client.xGroupDelConsumer('key', 'group', 'consumer'), +// 0 +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XGROUP_DESTROY.spec.ts b/packages/client/lib/commands/XGROUP_DESTROY.spec.ts index ea8e7b7be9..3e729337ae 100644 --- a/packages/client/lib/commands/XGROUP_DESTROY.spec.ts +++ b/packages/client/lib/commands/XGROUP_DESTROY.spec.ts @@ -1,23 +1,23 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XGROUP_DESTROY'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XGROUP_DESTROY'; -describe('XGROUP DESTROY', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group'), - ['XGROUP', 'DESTROY', 'key', 'group'] - ); - }); +// describe('XGROUP DESTROY', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group'), +// ['XGROUP', 'DESTROY', 'key', 'group'] +// ); +// }); - testUtils.testWithClient('client.xGroupDestroy', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xGroupDestroy', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.equal( - await client.xGroupDestroy('key', 'group'), - true - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.equal( +// await client.xGroupDestroy('key', 'group'), +// true +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XGROUP_SETID.spec.ts b/packages/client/lib/commands/XGROUP_SETID.spec.ts index 8df51f5401..6f05802ab0 100644 --- a/packages/client/lib/commands/XGROUP_SETID.spec.ts +++ b/packages/client/lib/commands/XGROUP_SETID.spec.ts @@ -1,23 +1,23 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XGROUP_SETID'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XGROUP_SETID'; -describe('XGROUP SETID', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group', '0'), - ['XGROUP', 'SETID', 'key', 'group', '0'] - ); - }); +// describe('XGROUP SETID', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '0'), +// ['XGROUP', 'SETID', 'key', 'group', '0'] +// ); +// }); - testUtils.testWithClient('client.xGroupSetId', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xGroupSetId', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.equal( - await client.xGroupSetId('key', 'group', '0'), - 'OK' - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.equal( +// await client.xGroupSetId('key', 'group', '0'), +// 'OK' +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XINFO_CONSUMERS.spec.ts b/packages/client/lib/commands/XINFO_CONSUMERS.spec.ts index 87c82b34f2..bfbd946bba 100644 --- a/packages/client/lib/commands/XINFO_CONSUMERS.spec.ts +++ b/packages/client/lib/commands/XINFO_CONSUMERS.spec.ts @@ -1,41 +1,41 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments, transformReply } from './XINFO_CONSUMERS'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments, transformReply } from './XINFO_CONSUMERS'; -describe('XINFO CONSUMERS', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group'), - ['XINFO', 'CONSUMERS', 'key', 'group'] - ); - }); +// describe('XINFO CONSUMERS', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group'), +// ['XINFO', 'CONSUMERS', 'key', 'group'] +// ); +// }); - it('transformReply', () => { - assert.deepEqual( - transformReply([ - ['name', 'Alice', 'pending', 1, 'idle', 9104628], - ['name', 'Bob', 'pending', 1, 'idle', 83841983] - ]), - [{ - name: 'Alice', - pending: 1, - idle: 9104628 - }, { - name: 'Bob', - pending: 1, - idle: 83841983 - }] - ); - }); +// it('transformReply', () => { +// assert.deepEqual( +// transformReply([ +// ['name', 'Alice', 'pending', 1, 'idle', 9104628], +// ['name', 'Bob', 'pending', 1, 'idle', 83841983] +// ]), +// [{ +// name: 'Alice', +// pending: 1, +// idle: 9104628 +// }, { +// name: 'Bob', +// pending: 1, +// idle: 83841983 +// }] +// ); +// }); - testUtils.testWithClient('client.xInfoConsumers', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xInfoConsumers', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xInfoConsumers('key', 'group'), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xInfoConsumers('key', 'group'), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XINFO_GROUPS.spec.ts b/packages/client/lib/commands/XINFO_GROUPS.spec.ts index dea8ac58d9..7380251db6 100644 --- a/packages/client/lib/commands/XINFO_GROUPS.spec.ts +++ b/packages/client/lib/commands/XINFO_GROUPS.spec.ts @@ -1,48 +1,48 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments, transformReply } from './XINFO_GROUPS'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments, transformReply } from './XINFO_GROUPS'; -describe('XINFO GROUPS', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['XINFO', 'GROUPS', 'key'] - ); - }); +// describe('XINFO GROUPS', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key'), +// ['XINFO', 'GROUPS', 'key'] +// ); +// }); - it('transformReply', () => { - assert.deepEqual( - transformReply([ - ['name', 'mygroup', 'consumers', 2, 'pending', 2, 'last-delivered-id', '1588152489012-0'], - ['name', 'some-other-group', 'consumers', 1, 'pending', 0, 'last-delivered-id', '1588152498034-0'] - ]), - [{ - name: 'mygroup', - consumers: 2, - pending: 2, - lastDeliveredId: '1588152489012-0' - }, { - name: 'some-other-group', - consumers: 1, - pending: 0, - lastDeliveredId: '1588152498034-0' - }] - ); - }); +// it('transformReply', () => { +// assert.deepEqual( +// transformReply([ +// ['name', 'mygroup', 'consumers', 2, 'pending', 2, 'last-delivered-id', '1588152489012-0'], +// ['name', 'some-other-group', 'consumers', 1, 'pending', 0, 'last-delivered-id', '1588152498034-0'] +// ]), +// [{ +// name: 'mygroup', +// consumers: 2, +// pending: 2, +// lastDeliveredId: '1588152489012-0' +// }, { +// name: 'some-other-group', +// consumers: 1, +// pending: 0, +// lastDeliveredId: '1588152498034-0' +// }] +// ); +// }); - testUtils.testWithClient('client.xInfoGroups', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xInfoGroups', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xInfoGroups('key'), - [{ - name: 'group', - consumers: 0, - pending: 0, - lastDeliveredId: '0-0' - }] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xInfoGroups('key'), +// [{ +// name: 'group', +// consumers: 0, +// pending: 0, +// lastDeliveredId: '0-0' +// }] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XINFO_STREAM.spec.ts b/packages/client/lib/commands/XINFO_STREAM.spec.ts index ca8d44f287..a73c460708 100644 --- a/packages/client/lib/commands/XINFO_STREAM.spec.ts +++ b/packages/client/lib/commands/XINFO_STREAM.spec.ts @@ -1,72 +1,72 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments, transformReply } from './XINFO_STREAM'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments, transformReply } from './XINFO_STREAM'; -describe('XINFO STREAM', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['XINFO', 'STREAM', 'key'] - ); - }); +// describe('XINFO STREAM', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key'), +// ['XINFO', 'STREAM', 'key'] +// ); +// }); - it('transformReply', () => { - assert.deepEqual( - transformReply([ - 'length', 2, - 'radix-tree-keys', 1, - 'radix-tree-nodes', 2, - 'last-generated-id', '1538385846314-0', - 'groups', 2, - 'first-entry', ['1538385820729-0', ['foo', 'bar']], - 'last-entry', ['1538385846314-0', ['field', 'value']] - ]), - { - length: 2, - radixTreeKeys: 1, - radixTreeNodes: 2, - groups: 2, - lastGeneratedId: '1538385846314-0', - firstEntry: { - id: '1538385820729-0', - message: Object.create(null, { - foo: { - value: 'bar', - configurable: true, - enumerable: true - } - }) - }, - lastEntry: { - id: '1538385846314-0', - message: Object.create(null, { - field: { - value: 'value', - configurable: true, - enumerable: true - } - }) - } - } - ); - }); +// it('transformReply', () => { +// assert.deepEqual( +// transformReply([ +// 'length', 2, +// 'radix-tree-keys', 1, +// 'radix-tree-nodes', 2, +// 'last-generated-id', '1538385846314-0', +// 'groups', 2, +// 'first-entry', ['1538385820729-0', ['foo', 'bar']], +// 'last-entry', ['1538385846314-0', ['field', 'value']] +// ]), +// { +// length: 2, +// radixTreeKeys: 1, +// radixTreeNodes: 2, +// groups: 2, +// lastGeneratedId: '1538385846314-0', +// firstEntry: { +// id: '1538385820729-0', +// message: Object.create(null, { +// foo: { +// value: 'bar', +// configurable: true, +// enumerable: true +// } +// }) +// }, +// lastEntry: { +// id: '1538385846314-0', +// message: Object.create(null, { +// field: { +// value: 'value', +// configurable: true, +// enumerable: true +// } +// }) +// } +// } +// ); +// }); - testUtils.testWithClient('client.xInfoStream', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xInfoStream', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xInfoStream('key'), - { - length: 0, - radixTreeKeys: 0, - radixTreeNodes: 1, - groups: 1, - lastGeneratedId: '0-0', - firstEntry: null, - lastEntry: null - } - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xInfoStream('key'), +// { +// length: 0, +// radixTreeKeys: 0, +// radixTreeNodes: 1, +// groups: 1, +// lastGeneratedId: '0-0', +// firstEntry: null, +// lastEntry: null +// } +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XLEN.spec.ts b/packages/client/lib/commands/XLEN.spec.ts index 178024ba89..8f2bf1a8c7 100644 --- a/packages/client/lib/commands/XLEN.spec.ts +++ b/packages/client/lib/commands/XLEN.spec.ts @@ -1,19 +1,22 @@ import { strict as assert } from 'assert'; import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XLEN'; +import XLEN from './XLEN'; describe('XLEN', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key'), - ['XLEN', 'key'] - ); - }); + it('transformArguments', () => { + assert.deepEqual( + XLEN.transformArguments('key'), + ['XLEN', 'key'] + ); + }); - testUtils.testWithClient('client.xLen', async client => { - assert.equal( - await client.xLen('key'), - 0 - ); - }, GLOBAL.SERVERS.OPEN); + testUtils.testAll('xLen', async client => { + assert.equal( + await client.xLen('key'), + 0 + ); + }, { + client: GLOBAL.SERVERS.OPEN, + cluster: GLOBAL.CLUSTERS.OPEN + }); }); diff --git a/packages/client/lib/commands/XPENDING.spec.ts b/packages/client/lib/commands/XPENDING.spec.ts index b1fef2a217..bfa36d01e3 100644 --- a/packages/client/lib/commands/XPENDING.spec.ts +++ b/packages/client/lib/commands/XPENDING.spec.ts @@ -1,62 +1,62 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XPENDING'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XPENDING'; -describe('XPENDING', () => { - describe('transformArguments', () => { - it('transformArguments', () => { - assert.deepEqual( - transformArguments('key', 'group'), - ['XPENDING', 'key', 'group'] - ); - }); - }); +// describe('XPENDING', () => { +// describe('transformArguments', () => { +// it('transformArguments', () => { +// assert.deepEqual( +// transformArguments('key', 'group'), +// ['XPENDING', 'key', 'group'] +// ); +// }); +// }); - describe('client.xPending', () => { - testUtils.testWithClient('simple', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// describe('client.xPending', () => { +// testUtils.testWithClient('simple', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xPending('key', 'group'), - { - pending: 0, - firstId: null, - lastId: null, - consumers: null - } - ); - }, GLOBAL.SERVERS.OPEN); +// assert.deepEqual( +// await client.xPending('key', 'group'), +// { +// pending: 0, +// firstId: null, +// lastId: null, +// consumers: null +// } +// ); +// }, GLOBAL.SERVERS.OPEN); - testUtils.testWithClient('with consumers', async client => { - const [,, id] = await Promise.all([ - client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - client.xGroupCreateConsumer('key', 'group', 'consumer'), - client.xAdd('key', '*', { field: 'value' }), - client.xReadGroup('group', 'consumer', { - key: 'key', - id: '>' - }) - ]); +// testUtils.testWithClient('with consumers', async client => { +// const [,, id] = await Promise.all([ +// client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// client.xGroupCreateConsumer('key', 'group', 'consumer'), +// client.xAdd('key', '*', { field: 'value' }), +// client.xReadGroup('group', 'consumer', { +// key: 'key', +// id: '>' +// }) +// ]); - assert.deepEqual( - await client.xPending('key', 'group'), - { - pending: 1, - firstId: id, - lastId: id, - consumers: [{ - name: 'consumer', - deliveriesCounter: 1 - }] - } - ); - }, { - ...GLOBAL.SERVERS.OPEN, - minimumDockerVersion: [6, 2] - }); - }); -}); +// assert.deepEqual( +// await client.xPending('key', 'group'), +// { +// pending: 1, +// firstId: id, +// lastId: id, +// consumers: [{ +// name: 'consumer', +// deliveriesCounter: 1 +// }] +// } +// ); +// }, { +// ...GLOBAL.SERVERS.OPEN, +// minimumDockerVersion: [6, 2] +// }); +// }); +// }); diff --git a/packages/client/lib/commands/XPENDING_RANGE.spec.ts b/packages/client/lib/commands/XPENDING_RANGE.spec.ts index 0b57c704bb..b08f71d88a 100644 --- a/packages/client/lib/commands/XPENDING_RANGE.spec.ts +++ b/packages/client/lib/commands/XPENDING_RANGE.spec.ts @@ -1,53 +1,53 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XPENDING_RANGE'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XPENDING_RANGE'; -describe('XPENDING RANGE', () => { - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key', 'group', '-', '+', 1), - ['XPENDING', 'key', 'group', '-', '+', '1'] - ); - }); +// describe('XPENDING RANGE', () => { +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '-', '+', 1), +// ['XPENDING', 'key', 'group', '-', '+', '1'] +// ); +// }); - it('with IDLE', () => { - assert.deepEqual( - transformArguments('key', 'group', '-', '+', 1, { - IDLE: 1, - }), - ['XPENDING', 'key', 'group', 'IDLE', '1', '-', '+', '1'] - ); - }); +// it('with IDLE', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '-', '+', 1, { +// IDLE: 1, +// }), +// ['XPENDING', 'key', 'group', 'IDLE', '1', '-', '+', '1'] +// ); +// }); - it('with consumer', () => { - assert.deepEqual( - transformArguments('key', 'group', '-', '+', 1, { - consumer: 'consumer' - }), - ['XPENDING', 'key', 'group', '-', '+', '1', 'consumer'] - ); - }); +// it('with consumer', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '-', '+', 1, { +// consumer: 'consumer' +// }), +// ['XPENDING', 'key', 'group', '-', '+', '1', 'consumer'] +// ); +// }); - it('with IDLE, consumer', () => { - assert.deepEqual( - transformArguments('key', 'group', '-', '+', 1, { - IDLE: 1, - consumer: 'consumer' - }), - ['XPENDING', 'key', 'group', 'IDLE', '1', '-', '+', '1', 'consumer'] - ); - }); - }); +// it('with IDLE, consumer', () => { +// assert.deepEqual( +// transformArguments('key', 'group', '-', '+', 1, { +// IDLE: 1, +// consumer: 'consumer' +// }), +// ['XPENDING', 'key', 'group', 'IDLE', '1', '-', '+', '1', 'consumer'] +// ); +// }); +// }); - testUtils.testWithClient('client.xPendingRange', async client => { - await client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }); +// testUtils.testWithClient('client.xPendingRange', async client => { +// await client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }); - assert.deepEqual( - await client.xPendingRange('key', 'group', '-', '+', 1), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// assert.deepEqual( +// await client.xPendingRange('key', 'group', '-', '+', 1), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XRANGE.spec.ts b/packages/client/lib/commands/XRANGE.spec.ts index 01c713e959..4d937c4e32 100644 --- a/packages/client/lib/commands/XRANGE.spec.ts +++ b/packages/client/lib/commands/XRANGE.spec.ts @@ -1,30 +1,30 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XRANGE'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XRANGE'; -describe('XRANGE', () => { - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key', '-', '+'), - ['XRANGE', 'key', '-', '+'] - ); - }); +// describe('XRANGE', () => { +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key', '-', '+'), +// ['XRANGE', 'key', '-', '+'] +// ); +// }); - it('with COUNT', () => { - assert.deepEqual( - transformArguments('key', '-', '+', { - COUNT: 1 - }), - ['XRANGE', 'key', '-', '+', 'COUNT', '1'] - ); - }); - }); +// it('with COUNT', () => { +// assert.deepEqual( +// transformArguments('key', '-', '+', { +// COUNT: 1 +// }), +// ['XRANGE', 'key', '-', '+', 'COUNT', '1'] +// ); +// }); +// }); - testUtils.testWithClient('client.xRange', async client => { - assert.deepEqual( - await client.xRange('key', '+', '-'), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xRange', async client => { +// assert.deepEqual( +// await client.xRange('key', '+', '-'), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XREAD.spec.ts b/packages/client/lib/commands/XREAD.spec.ts index b607f53532..13aa35b83f 100644 --- a/packages/client/lib/commands/XREAD.spec.ts +++ b/packages/client/lib/commands/XREAD.spec.ts @@ -1,103 +1,103 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { FIRST_KEY_INDEX, transformArguments } from './XREAD'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { FIRST_KEY_INDEX, transformArguments } from './XREAD'; -describe('XREAD', () => { - describe('FIRST_KEY_INDEX', () => { - it('single stream', () => { - assert.equal( - FIRST_KEY_INDEX({ key: 'key', id: '' }), - 'key' - ); - }); +// describe('XREAD', () => { +// describe('FIRST_KEY_INDEX', () => { +// it('single stream', () => { +// assert.equal( +// FIRST_KEY_INDEX({ key: 'key', id: '' }), +// 'key' +// ); +// }); - it('multiple streams', () => { - assert.equal( - FIRST_KEY_INDEX([{ key: '1', id: '' }, { key: '2', id: '' }]), - '1' - ); - }); - }); +// it('multiple streams', () => { +// assert.equal( +// FIRST_KEY_INDEX([{ key: '1', id: '' }, { key: '2', id: '' }]), +// '1' +// ); +// }); +// }); - describe('transformArguments', () => { - it('single stream', () => { - assert.deepEqual( - transformArguments({ - key: 'key', - id: '0' - }), - ['XREAD', 'STREAMS', 'key', '0'] - ); - }); +// describe('transformArguments', () => { +// it('single stream', () => { +// assert.deepEqual( +// transformArguments({ +// key: 'key', +// id: '0' +// }), +// ['XREAD', 'STREAMS', 'key', '0'] +// ); +// }); - it('multiple streams', () => { - assert.deepEqual( - transformArguments([{ - key: '1', - id: '0' - }, { - key: '2', - id: '0' - }]), - ['XREAD', 'STREAMS', '1', '2', '0', '0'] - ); - }); +// it('multiple streams', () => { +// assert.deepEqual( +// transformArguments([{ +// key: '1', +// id: '0' +// }, { +// key: '2', +// id: '0' +// }]), +// ['XREAD', 'STREAMS', '1', '2', '0', '0'] +// ); +// }); - it('with COUNT', () => { - assert.deepEqual( - transformArguments({ - key: 'key', - id: '0' - }, { - COUNT: 1 - }), - ['XREAD', 'COUNT', '1', 'STREAMS', 'key', '0'] - ); - }); +// it('with COUNT', () => { +// assert.deepEqual( +// transformArguments({ +// key: 'key', +// id: '0' +// }, { +// COUNT: 1 +// }), +// ['XREAD', 'COUNT', '1', 'STREAMS', 'key', '0'] +// ); +// }); - it('with BLOCK', () => { - assert.deepEqual( - transformArguments({ - key: 'key', - id: '0' - }, { - BLOCK: 0 - }), - ['XREAD', 'BLOCK', '0', 'STREAMS', 'key', '0'] - ); - }); +// it('with BLOCK', () => { +// assert.deepEqual( +// transformArguments({ +// key: 'key', +// id: '0' +// }, { +// BLOCK: 0 +// }), +// ['XREAD', 'BLOCK', '0', 'STREAMS', 'key', '0'] +// ); +// }); - it('with COUNT, BLOCK', () => { - assert.deepEqual( - transformArguments({ - key: 'key', - id: '0' - }, { - COUNT: 1, - BLOCK: 0 - }), - ['XREAD', 'COUNT', '1', 'BLOCK', '0', 'STREAMS', 'key', '0'] - ); - }); - }); +// it('with COUNT, BLOCK', () => { +// assert.deepEqual( +// transformArguments({ +// key: 'key', +// id: '0' +// }, { +// COUNT: 1, +// BLOCK: 0 +// }), +// ['XREAD', 'COUNT', '1', 'BLOCK', '0', 'STREAMS', 'key', '0'] +// ); +// }); +// }); - testUtils.testWithClient('client.xRead', async client => { - assert.equal( - await client.xRead({ - key: 'key', - id: '0' - }), - null - ); - }, GLOBAL.SERVERS.OPEN); +// testUtils.testWithClient('client.xRead', async client => { +// assert.equal( +// await client.xRead({ +// key: 'key', +// id: '0' +// }), +// null +// ); +// }, GLOBAL.SERVERS.OPEN); - testUtils.testWithCluster('cluster.xRead', async cluster => { - assert.equal( - await cluster.xRead({ - key: 'key', - id: '0' - }), - null - ); - }, GLOBAL.CLUSTERS.OPEN); -}); +// testUtils.testWithCluster('cluster.xRead', async cluster => { +// assert.equal( +// await cluster.xRead({ +// key: 'key', +// id: '0' +// }), +// null +// ); +// }, GLOBAL.CLUSTERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XREADGROUP.spec.ts b/packages/client/lib/commands/XREADGROUP.spec.ts index fa196d504a..1cccdb79e6 100644 --- a/packages/client/lib/commands/XREADGROUP.spec.ts +++ b/packages/client/lib/commands/XREADGROUP.spec.ts @@ -1,153 +1,153 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { FIRST_KEY_INDEX, transformArguments } from './XREADGROUP'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { FIRST_KEY_INDEX, transformArguments } from './XREADGROUP'; -describe('XREADGROUP', () => { - describe('FIRST_KEY_INDEX', () => { - it('single stream', () => { - assert.equal( - FIRST_KEY_INDEX('', '', { key: 'key', id: '' }), - 'key' - ); - }); +// describe('XREADGROUP', () => { +// describe('FIRST_KEY_INDEX', () => { +// it('single stream', () => { +// assert.equal( +// FIRST_KEY_INDEX('', '', { key: 'key', id: '' }), +// 'key' +// ); +// }); - it('multiple streams', () => { - assert.equal( - FIRST_KEY_INDEX('', '', [{ key: '1', id: '' }, { key: '2', id: '' }]), - '1' - ); - }); - }); +// it('multiple streams', () => { +// assert.equal( +// FIRST_KEY_INDEX('', '', [{ key: '1', id: '' }, { key: '2', id: '' }]), +// '1' +// ); +// }); +// }); - describe('transformArguments', () => { - it('single stream', () => { - assert.deepEqual( - transformArguments('group', 'consumer', { - key: 'key', - id: '0' - }), - ['XREADGROUP', 'GROUP', 'group', 'consumer', 'STREAMS', 'key', '0'] - ); - }); +// describe('transformArguments', () => { +// it('single stream', () => { +// assert.deepEqual( +// transformArguments('group', 'consumer', { +// key: 'key', +// id: '0' +// }), +// ['XREADGROUP', 'GROUP', 'group', 'consumer', 'STREAMS', 'key', '0'] +// ); +// }); - it('multiple streams', () => { - assert.deepEqual( - transformArguments('group', 'consumer', [{ - key: '1', - id: '0' - }, { - key: '2', - id: '0' - }]), - ['XREADGROUP', 'GROUP', 'group', 'consumer', 'STREAMS', '1', '2', '0', '0'] - ); - }); +// it('multiple streams', () => { +// assert.deepEqual( +// transformArguments('group', 'consumer', [{ +// key: '1', +// id: '0' +// }, { +// key: '2', +// id: '0' +// }]), +// ['XREADGROUP', 'GROUP', 'group', 'consumer', 'STREAMS', '1', '2', '0', '0'] +// ); +// }); - it('with COUNT', () => { - assert.deepEqual( - transformArguments('group', 'consumer', { - key: 'key', - id: '0' - }, { - COUNT: 1 - }), - ['XREADGROUP', 'GROUP', 'group', 'consumer', 'COUNT', '1', 'STREAMS', 'key', '0'] - ); - }); +// it('with COUNT', () => { +// assert.deepEqual( +// transformArguments('group', 'consumer', { +// key: 'key', +// id: '0' +// }, { +// COUNT: 1 +// }), +// ['XREADGROUP', 'GROUP', 'group', 'consumer', 'COUNT', '1', 'STREAMS', 'key', '0'] +// ); +// }); - it('with BLOCK', () => { - assert.deepEqual( - transformArguments('group', 'consumer', { - key: 'key', - id: '0' - }, { - BLOCK: 0 - }), - ['XREADGROUP', 'GROUP', 'group', 'consumer', 'BLOCK', '0', 'STREAMS', 'key', '0'] - ); - }); +// it('with BLOCK', () => { +// assert.deepEqual( +// transformArguments('group', 'consumer', { +// key: 'key', +// id: '0' +// }, { +// BLOCK: 0 +// }), +// ['XREADGROUP', 'GROUP', 'group', 'consumer', 'BLOCK', '0', 'STREAMS', 'key', '0'] +// ); +// }); - it('with NOACK', () => { - assert.deepEqual( - transformArguments('group', 'consumer', { - key: 'key', - id: '0' - }, { - NOACK: true - }), - ['XREADGROUP', 'GROUP', 'group', 'consumer', 'NOACK', 'STREAMS', 'key', '0'] - ); - }); +// it('with NOACK', () => { +// assert.deepEqual( +// transformArguments('group', 'consumer', { +// key: 'key', +// id: '0' +// }, { +// NOACK: true +// }), +// ['XREADGROUP', 'GROUP', 'group', 'consumer', 'NOACK', 'STREAMS', 'key', '0'] +// ); +// }); - it('with COUNT, BLOCK, NOACK', () => { - assert.deepEqual( - transformArguments('group', 'consumer', { - key: 'key', - id: '0' - }, { - COUNT: 1, - BLOCK: 0, - NOACK: true - }), - ['XREADGROUP', 'GROUP', 'group', 'consumer', 'COUNT', '1', 'BLOCK', '0', 'NOACK', 'STREAMS', 'key', '0'] - ); - }); - }); +// it('with COUNT, BLOCK, NOACK', () => { +// assert.deepEqual( +// transformArguments('group', 'consumer', { +// key: 'key', +// id: '0' +// }, { +// COUNT: 1, +// BLOCK: 0, +// NOACK: true +// }), +// ['XREADGROUP', 'GROUP', 'group', 'consumer', 'COUNT', '1', 'BLOCK', '0', 'NOACK', 'STREAMS', 'key', '0'] +// ); +// }); +// }); - describe('client.xReadGroup', () => { - testUtils.testWithClient('null', async client => { - const [, readGroupReply] = await Promise.all([ - client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - client.xReadGroup('group', 'consumer', { - key: 'key', - id: '>' - }) - ]); +// describe('client.xReadGroup', () => { +// testUtils.testWithClient('null', async client => { +// const [, readGroupReply] = await Promise.all([ +// client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// client.xReadGroup('group', 'consumer', { +// key: 'key', +// id: '>' +// }) +// ]); - assert.equal(readGroupReply, null); - }, GLOBAL.SERVERS.OPEN); +// assert.equal(readGroupReply, null); +// }, GLOBAL.SERVERS.OPEN); - testUtils.testWithClient('with a message', async client => { - const [, id, readGroupReply] = await Promise.all([ - client.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - client.xAdd('key', '*', { field: 'value' }), - client.xReadGroup('group', 'consumer', { - key: 'key', - id: '>' - }) - ]); +// testUtils.testWithClient('with a message', async client => { +// const [, id, readGroupReply] = await Promise.all([ +// client.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// client.xAdd('key', '*', { field: 'value' }), +// client.xReadGroup('group', 'consumer', { +// key: 'key', +// id: '>' +// }) +// ]); - assert.deepEqual(readGroupReply, [{ - name: 'key', - messages: [{ - id, - message: Object.create(null, { - field: { - value: 'value', - configurable: true, - enumerable: true - } - }) - }] - }]); - }, GLOBAL.SERVERS.OPEN); - }); +// assert.deepEqual(readGroupReply, [{ +// name: 'key', +// messages: [{ +// id, +// message: Object.create(null, { +// field: { +// value: 'value', +// configurable: true, +// enumerable: true +// } +// }) +// }] +// }]); +// }, GLOBAL.SERVERS.OPEN); +// }); - testUtils.testWithCluster('cluster.xReadGroup', async cluster => { - const [, readGroupReply] = await Promise.all([ - cluster.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - cluster.xReadGroup('group', 'consumer', { - key: 'key', - id: '>' - }) - ]); +// testUtils.testWithCluster('cluster.xReadGroup', async cluster => { +// const [, readGroupReply] = await Promise.all([ +// cluster.xGroupCreate('key', 'group', '$', { +// MKSTREAM: true +// }), +// cluster.xReadGroup('group', 'consumer', { +// key: 'key', +// id: '>' +// }) +// ]); - assert.equal(readGroupReply, null); - }, GLOBAL.CLUSTERS.OPEN); -}); +// assert.equal(readGroupReply, null); +// }, GLOBAL.CLUSTERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XREVRANGE.spec.ts b/packages/client/lib/commands/XREVRANGE.spec.ts index fd6e1a3adf..344edd62e5 100644 --- a/packages/client/lib/commands/XREVRANGE.spec.ts +++ b/packages/client/lib/commands/XREVRANGE.spec.ts @@ -1,30 +1,30 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XREVRANGE'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XREVRANGE'; -describe('XREVRANGE', () => { - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key', '-', '+'), - ['XREVRANGE', 'key', '-', '+'] - ); - }); +// describe('XREVRANGE', () => { +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key', '-', '+'), +// ['XREVRANGE', 'key', '-', '+'] +// ); +// }); - it('with COUNT', () => { - assert.deepEqual( - transformArguments('key', '-', '+', { - COUNT: 1 - }), - ['XREVRANGE', 'key', '-', '+', 'COUNT', '1'] - ); - }); - }); +// it('with COUNT', () => { +// assert.deepEqual( +// transformArguments('key', '-', '+', { +// COUNT: 1 +// }), +// ['XREVRANGE', 'key', '-', '+', 'COUNT', '1'] +// ); +// }); +// }); - testUtils.testWithClient('client.xRevRange', async client => { - assert.deepEqual( - await client.xRevRange('key', '+', '-'), - [] - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xRevRange', async client => { +// assert.deepEqual( +// await client.xRevRange('key', '+', '-'), +// [] +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/XTRIM.spec.ts b/packages/client/lib/commands/XTRIM.spec.ts index a8f8078eb2..bcbb1c928c 100644 --- a/packages/client/lib/commands/XTRIM.spec.ts +++ b/packages/client/lib/commands/XTRIM.spec.ts @@ -1,49 +1,49 @@ -import { strict as assert } from 'assert'; -import testUtils, { GLOBAL } from '../test-utils'; -import { transformArguments } from './XTRIM'; +// import { strict as assert } from 'assert'; +// import testUtils, { GLOBAL } from '../test-utils'; +// import { transformArguments } from './XTRIM'; -describe('XTRIM', () => { - describe('transformArguments', () => { - it('simple', () => { - assert.deepEqual( - transformArguments('key', 'MAXLEN', 1), - ['XTRIM', 'key', 'MAXLEN', '1'] - ); - }); +// describe('XTRIM', () => { +// describe('transformArguments', () => { +// it('simple', () => { +// assert.deepEqual( +// transformArguments('key', 'MAXLEN', 1), +// ['XTRIM', 'key', 'MAXLEN', '1'] +// ); +// }); - it('with strategyModifier', () => { - assert.deepEqual( - transformArguments('key', 'MAXLEN', 1, { - strategyModifier: '=' - }), - ['XTRIM', 'key', 'MAXLEN', '=', '1'] - ); - }); +// it('with strategyModifier', () => { +// assert.deepEqual( +// transformArguments('key', 'MAXLEN', 1, { +// strategyModifier: '=' +// }), +// ['XTRIM', 'key', 'MAXLEN', '=', '1'] +// ); +// }); - it('with LIMIT', () => { - assert.deepEqual( - transformArguments('key', 'MAXLEN', 1, { - LIMIT: 1 - }), - ['XTRIM', 'key', 'MAXLEN', '1', 'LIMIT', '1'] - ); - }); +// it('with LIMIT', () => { +// assert.deepEqual( +// transformArguments('key', 'MAXLEN', 1, { +// LIMIT: 1 +// }), +// ['XTRIM', 'key', 'MAXLEN', '1', 'LIMIT', '1'] +// ); +// }); - it('with strategyModifier, LIMIT', () => { - assert.deepEqual( - transformArguments('key', 'MAXLEN', 1, { - strategyModifier: '=', - LIMIT: 1 - }), - ['XTRIM', 'key', 'MAXLEN', '=', '1', 'LIMIT', '1'] - ); - }); - }); +// it('with strategyModifier, LIMIT', () => { +// assert.deepEqual( +// transformArguments('key', 'MAXLEN', 1, { +// strategyModifier: '=', +// LIMIT: 1 +// }), +// ['XTRIM', 'key', 'MAXLEN', '=', '1', 'LIMIT', '1'] +// ); +// }); +// }); - testUtils.testWithClient('client.xTrim', async client => { - assert.equal( - await client.xTrim('key', 'MAXLEN', 1), - 0 - ); - }, GLOBAL.SERVERS.OPEN); -}); +// testUtils.testWithClient('client.xTrim', async client => { +// assert.equal( +// await client.xTrim('key', 'MAXLEN', 1), +// 0 +// ); +// }, GLOBAL.SERVERS.OPEN); +// }); diff --git a/packages/client/lib/commands/index.ts b/packages/client/lib/commands/index.ts index 83a83c76de..394d215954 100644 --- a/packages/client/lib/commands/index.ts +++ b/packages/client/lib/commands/index.ts @@ -104,8 +104,20 @@ import SETEX from './SETEX'; import SETNX from './SETNX'; import SETRANGE from './SETRANGE'; import SMEMBERS from './SMEMBERS'; +import SPUBLISH from './SPUBLISH'; +import SRANDMEMBER_COUNT from './SRANDMEMBER_COUNT'; +import SRANDMEMBER from './SRANDMEMBER'; +import SREM from './SREM'; import SSCAN from './SSCAN'; import STRLEN from './STRLEN'; +import TOUCH from './TOUCH'; +import TTL from './TTL'; +import TYPE from './TYPE'; +import UNLINK from './UNLINK'; +import UNWATCH from './UNWATCH'; +import WAIT from './WAIT'; +import WATCH from './WATCH'; +import XLEN from './XLEN'; import ZADD from './ZADD'; import ZCARD from './ZCARD'; import ZCOUNT from './ZCOUNT'; @@ -344,10 +356,34 @@ export default { setRange: SETRANGE, SMEMBERS, sMembers: SMEMBERS, + SPUBLISH, + sPublish: SPUBLISH, + SRANDMEMBER_COUNT, + sRandMemberCount: SRANDMEMBER_COUNT, + SRANDMEMBER, + sRandMember: SRANDMEMBER, + SREM, + sRem: SREM, SSCAN, sScan: SSCAN, STRLEN, strLen: STRLEN, + TOUCH, + touch: TOUCH, + TTL, + ttl: TTL, + TYPE, + type: TYPE, + UNLINK, + unlink: UNLINK, + UNWATCH, + unwatch: UNWATCH, + WAIT, + wait: WAIT, + WATCH, + watch: WATCH, + XLEN, + xLen: XLEN, ZADD, zAdd: ZADD, ZCARD, diff --git a/packages/test-utils/lib/index.ts b/packages/test-utils/lib/index.ts index 7a783792ec..0fb311bff8 100644 --- a/packages/test-utils/lib/index.ts +++ b/packages/test-utils/lib/index.ts @@ -13,7 +13,7 @@ import { createCluster, RedisClusterOptions, RedisClusterType -} from '@redis/client'; +} from '@redis/client/index'; import { RedisServerDockerConfig, spawnRedisServer, spawnRedisCluster } from './dockers'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers';