-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
453 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
import { strict as assert } from 'assert'; | ||
import testUtils, { GLOBAL } from '../test-utils'; | ||
import { transformArguments } from './LPOP'; | ||
import LPOP from './LPOP'; | ||
|
||
describe('LPOP', () => { | ||
it('transformArguments', () => { | ||
assert.deepEqual( | ||
transformArguments('key'), | ||
['LPOP', 'key'] | ||
); | ||
}); | ||
it('transformArguments', () => { | ||
assert.deepEqual( | ||
LPOP.transformArguments('key'), | ||
['LPOP', 'key'] | ||
); | ||
}); | ||
|
||
testUtils.testWithClient('client.lPop', async client => { | ||
assert.equal( | ||
await client.lPop('key'), | ||
null | ||
); | ||
}, GLOBAL.SERVERS.OPEN); | ||
|
||
testUtils.testWithCluster('cluster.lPop', async cluster => { | ||
assert.equal( | ||
await cluster.lPop('key'), | ||
null | ||
); | ||
}, GLOBAL.CLUSTERS.OPEN); | ||
testUtils.testAll('lPop', async client => { | ||
assert.equal( | ||
await client.lPop('key'), | ||
null | ||
); | ||
}, { | ||
client: GLOBAL.SERVERS.OPEN, | ||
cluster: GLOBAL.CLUSTERS.OPEN | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
import { strict as assert } from 'assert'; | ||
import testUtils, { GLOBAL } from '../test-utils'; | ||
import { transformArguments } from './LPOP_COUNT'; | ||
import LPOP_COUNT from './LPOP_COUNT'; | ||
|
||
describe('LPOP COUNT', () => { | ||
testUtils.isVersionGreaterThanHook([6, 2]); | ||
testUtils.isVersionGreaterThanHook([6, 2]); | ||
|
||
it('transformArguments', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 1), | ||
['LPOP', 'key', '1'] | ||
); | ||
}); | ||
it('transformArguments', () => { | ||
assert.deepEqual( | ||
LPOP_COUNT.transformArguments('key', 1), | ||
['LPOP', 'key', '1'] | ||
); | ||
}); | ||
|
||
testUtils.testWithClient('client.lPopCount', async client => { | ||
assert.equal( | ||
await client.lPopCount('key', 1), | ||
null | ||
); | ||
}, GLOBAL.SERVERS.OPEN); | ||
|
||
testUtils.testWithCluster('cluster.lPopCount', async cluster => { | ||
assert.equal( | ||
await cluster.lPopCount('key', 1), | ||
null | ||
); | ||
}, GLOBAL.CLUSTERS.OPEN); | ||
testUtils.testAll('lPopCount', async client => { | ||
assert.equal( | ||
await client.lPopCount('key', 1), | ||
null | ||
); | ||
}, { | ||
client: GLOBAL.SERVERS.OPEN, | ||
cluster: GLOBAL.CLUSTERS.OPEN | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,54 @@ | ||
import { strict as assert } from 'assert'; | ||
import testUtils, { GLOBAL } from '../test-utils'; | ||
import { transformArguments } from './LPOS'; | ||
import LPOS from './LPOS'; | ||
|
||
describe('LPOS', () => { | ||
testUtils.isVersionGreaterThanHook([6, 0, 6]); | ||
testUtils.isVersionGreaterThanHook([6, 0, 6]); | ||
|
||
describe('transformArguments', () => { | ||
it('simple', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element'), | ||
['LPOS', 'key', 'element'] | ||
); | ||
}); | ||
|
||
it('with RANK', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', { | ||
RANK: 0 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0'] | ||
); | ||
}); | ||
describe('transformArguments', () => { | ||
it('simple', () => { | ||
assert.deepEqual( | ||
LPOS.transformArguments('key', 'element'), | ||
['LPOS', 'key', 'element'] | ||
); | ||
}); | ||
|
||
it('with MAXLEN', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', { | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'MAXLEN', '10'] | ||
); | ||
}); | ||
it('with RANK', () => { | ||
assert.deepEqual( | ||
LPOS.transformArguments('key', 'element', { | ||
RANK: 0 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0'] | ||
); | ||
}); | ||
|
||
it('with RANK, MAXLEN', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', { | ||
RANK: 0, | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0', 'MAXLEN', '10'] | ||
); | ||
}); | ||
it('with MAXLEN', () => { | ||
assert.deepEqual( | ||
LPOS.transformArguments('key', 'element', { | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'MAXLEN', '10'] | ||
); | ||
}); | ||
|
||
testUtils.testWithClient('client.lPos', async client => { | ||
assert.equal( | ||
await client.lPos('key', 'element'), | ||
null | ||
); | ||
}, GLOBAL.SERVERS.OPEN); | ||
it('with RANK, MAXLEN', () => { | ||
assert.deepEqual( | ||
LPOS.transformArguments('key', 'element', { | ||
RANK: 0, | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0', 'MAXLEN', '10'] | ||
); | ||
}); | ||
}); | ||
|
||
testUtils.testWithCluster('cluster.lPos', async cluster => { | ||
assert.equal( | ||
await cluster.lPos('key', 'element'), | ||
null | ||
); | ||
}, GLOBAL.CLUSTERS.OPEN); | ||
testUtils.testAll('lPos', async client => { | ||
assert.equal( | ||
await client.lPos('key', 'element'), | ||
null | ||
); | ||
}, { | ||
client: GLOBAL.SERVERS.OPEN, | ||
cluster: GLOBAL.CLUSTERS.OPEN | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,54 @@ | ||
import { strict as assert } from 'assert'; | ||
import testUtils, { GLOBAL } from '../test-utils'; | ||
import { transformArguments } from './LPOS_COUNT'; | ||
import LPOS_COUNT from './LPOS_COUNT'; | ||
|
||
describe('LPOS COUNT', () => { | ||
testUtils.isVersionGreaterThanHook([6, 0, 6]); | ||
testUtils.isVersionGreaterThanHook([6, 0, 6]); | ||
|
||
describe('transformArguments', () => { | ||
it('simple', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', 0), | ||
['LPOS', 'key', 'element', 'COUNT', '0'] | ||
); | ||
}); | ||
|
||
it('with RANK', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', 0, { | ||
RANK: 0 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0', 'COUNT', '0'] | ||
); | ||
}); | ||
describe('transformArguments', () => { | ||
it('simple', () => { | ||
assert.deepEqual( | ||
LPOS_COUNT.transformArguments('key', 'element', 0), | ||
['LPOS', 'key', 'element', 'COUNT', '0'] | ||
); | ||
}); | ||
|
||
it('with MAXLEN', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', 0, { | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'COUNT', '0', 'MAXLEN', '10'] | ||
); | ||
}); | ||
it('with RANK', () => { | ||
assert.deepEqual( | ||
LPOS_COUNT.transformArguments('key', 'element', 0, { | ||
RANK: 0 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0', 'COUNT', '0'] | ||
); | ||
}); | ||
|
||
it('with RANK, MAXLEN', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'element', 0, { | ||
RANK: 0, | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0', 'COUNT', '0', 'MAXLEN', '10'] | ||
); | ||
}); | ||
it('with MAXLEN', () => { | ||
assert.deepEqual( | ||
LPOS_COUNT.transformArguments('key', 'element', 0, { | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'COUNT', '0', 'MAXLEN', '10'] | ||
); | ||
}); | ||
|
||
testUtils.testWithClient('client.lPosCount', async client => { | ||
assert.deepEqual( | ||
await client.lPosCount('key', 'element', 0), | ||
[] | ||
); | ||
}, GLOBAL.SERVERS.OPEN); | ||
it('with RANK, MAXLEN', () => { | ||
assert.deepEqual( | ||
LPOS_COUNT.transformArguments('key', 'element', 0, { | ||
RANK: 0, | ||
MAXLEN: 10 | ||
}), | ||
['LPOS', 'key', 'element', 'RANK', '0', 'COUNT', '0', 'MAXLEN', '10'] | ||
); | ||
}); | ||
}); | ||
|
||
testUtils.testWithCluster('cluster.lPosCount', async cluster => { | ||
assert.deepEqual( | ||
await cluster.lPosCount('key', 'element', 0), | ||
[] | ||
); | ||
}, GLOBAL.CLUSTERS.OPEN); | ||
testUtils.testAll('lPosCount', async client => { | ||
assert.deepEqual( | ||
await client.lPosCount('key', 'element', 0), | ||
[] | ||
); | ||
}, { | ||
client: GLOBAL.SERVERS.OPEN, | ||
cluster: GLOBAL.CLUSTERS.OPEN | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,31 @@ | ||
import { strict as assert } from 'assert'; | ||
import testUtils, { GLOBAL } from '../test-utils'; | ||
import { transformArguments } from './LPUSH'; | ||
import LPUSH from './LPUSH'; | ||
|
||
describe('LPUSH', () => { | ||
describe('transformArguments', () => { | ||
it('string', () => { | ||
assert.deepEqual( | ||
transformArguments('key', 'field'), | ||
['LPUSH', 'key', 'field'] | ||
); | ||
}); | ||
|
||
it('array', () => { | ||
assert.deepEqual( | ||
transformArguments('key', ['1', '2']), | ||
['LPUSH', 'key', '1', '2'] | ||
); | ||
}); | ||
describe('transformArguments', () => { | ||
it('string', () => { | ||
assert.deepEqual( | ||
LPUSH.transformArguments('key', 'field'), | ||
['LPUSH', 'key', 'field'] | ||
); | ||
}); | ||
|
||
testUtils.testWithClient('client.lPush', async client => { | ||
assert.equal( | ||
await client.lPush('key', 'field'), | ||
1 | ||
); | ||
}, GLOBAL.SERVERS.OPEN); | ||
it('array', () => { | ||
assert.deepEqual( | ||
LPUSH.transformArguments('key', ['1', '2']), | ||
['LPUSH', 'key', '1', '2'] | ||
); | ||
}); | ||
}); | ||
|
||
testUtils.testWithCluster('cluster.lPush', async cluster => { | ||
assert.equal( | ||
await cluster.lPush('key', 'field'), | ||
1 | ||
); | ||
}, GLOBAL.CLUSTERS.OPEN); | ||
testUtils.testAll('lPush', async client => { | ||
assert.equal( | ||
await client.lPush('key', 'field'), | ||
1 | ||
); | ||
}, { | ||
client: GLOBAL.SERVERS.OPEN, | ||
cluster: GLOBAL.CLUSTERS.OPEN | ||
}); | ||
}); |
Oops, something went wrong.