Skip to content

Commit 51b640b

Browse files
committed
add positive test for LINDEX
1 parent 641d534 commit 51b640b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

packages/client/lib/commands/LINDEX.spec.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@ describe('LINDEX', () => {
1010
);
1111
});
1212

13-
testUtils.testWithClient('client.lIndex', async client => {
14-
assert.equal(
15-
await client.lIndex('key', 0),
16-
null
17-
);
18-
}, GLOBAL.SERVERS.OPEN);
13+
describe('client.lIndex', () => {
14+
testUtils.testWithClient('null', async client => {
15+
assert.equal(
16+
await client.lIndex('key', 0),
17+
null
18+
);
19+
}, GLOBAL.SERVERS.OPEN);
20+
21+
testUtils.testWithClient('with value', async client => {
22+
const [, lIndexReply] = await Promise.all([
23+
client.lPush('key', 'element'),
24+
client.lIndex('key', 0)
25+
]);
26+
27+
assert.equal(lIndexReply, 'element');
28+
}, GLOBAL.SERVERS.OPEN);
29+
});
1930

2031
testUtils.testWithCluster('cluster.lIndex', async cluster => {
2132
assert.equal(

0 commit comments

Comments
 (0)