|
1 | | -// import { strict as assert } from 'assert'; |
2 | | -// import testUtils, { GLOBAL } from '../test-utils'; |
3 | | -// import { transformArguments } from './ZMPOP'; |
| 1 | +import { strict as assert } from 'assert'; |
| 2 | +import testUtils, { GLOBAL } from '../test-utils'; |
| 3 | +import ZMPOP from './ZMPOP'; |
4 | 4 |
|
5 | | -// describe('ZMPOP', () => { |
6 | | -// testUtils.isVersionGreaterThanHook([7]); |
| 5 | +describe('ZMPOP', () => { |
| 6 | + testUtils.isVersionGreaterThanHook([7]); |
7 | 7 |
|
8 | | -// describe('transformArguments', () => { |
9 | | -// it('simple', () => { |
10 | | -// assert.deepEqual( |
11 | | -// transformArguments('key', 'MIN'), |
12 | | -// ['ZMPOP', '1', 'key', 'MIN'] |
13 | | -// ); |
14 | | -// }); |
| 8 | + describe('transformArguments', () => { |
| 9 | + it('simple', () => { |
| 10 | + assert.deepEqual( |
| 11 | + ZMPOP.transformArguments('key', 'MIN'), |
| 12 | + ['ZMPOP', '1', 'key', 'MIN'] |
| 13 | + ); |
| 14 | + }); |
15 | 15 |
|
16 | | -// it('with score and count', () => { |
17 | | -// assert.deepEqual( |
18 | | -// transformArguments('key', 'MIN', { |
19 | | -// COUNT: 2 |
20 | | -// }), |
21 | | -// ['ZMPOP', '1', 'key', 'MIN', 'COUNT', '2'] |
22 | | -// ); |
23 | | -// }); |
24 | | -// }); |
| 16 | + it('with count', () => { |
| 17 | + assert.deepEqual( |
| 18 | + ZMPOP.transformArguments('key', 'MIN', { |
| 19 | + COUNT: 2 |
| 20 | + }), |
| 21 | + ['ZMPOP', '1', 'key', 'MIN', 'COUNT', '2'] |
| 22 | + ); |
| 23 | + }); |
| 24 | + }); |
25 | 25 |
|
26 | | -// testUtils.testWithClient('client.zmPop', async client => { |
27 | | -// assert.deepEqual( |
28 | | -// await client.zmPop('key', 'MIN'), |
29 | | -// null |
30 | | -// ); |
31 | | -// }, GLOBAL.SERVERS.OPEN); |
32 | | -// }); |
| 26 | + testUtils.testAll('zmPop - null', async client => { |
| 27 | + assert.equal( |
| 28 | + await client.zmPop('key', 'MIN'), |
| 29 | + null |
| 30 | + ); |
| 31 | + }, { |
| 32 | + client: GLOBAL.SERVERS.OPEN, |
| 33 | + cluster: GLOBAL.CLUSTERS.OPEN |
| 34 | + }); |
| 35 | + |
| 36 | + testUtils.testAll('zmPop - with members', async client => { |
| 37 | + const members = [{ |
| 38 | + value: '1', |
| 39 | + score: 1 |
| 40 | + }]; |
| 41 | + |
| 42 | + const [, reply] = await Promise.all([ |
| 43 | + client.zAdd('key', members), |
| 44 | + client.zmPop('key', 'MIN') |
| 45 | + ]); |
| 46 | + |
| 47 | + assert.deepEqual(reply, { |
| 48 | + key: 'key', |
| 49 | + members |
| 50 | + }); |
| 51 | + }, { |
| 52 | + client: GLOBAL.SERVERS.OPEN, |
| 53 | + cluster: GLOBAL.CLUSTERS.OPEN |
| 54 | + }); |
| 55 | +}); |
0 commit comments