|
|
|
@ -21,6 +21,16 @@ describe('List methods', () => {
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should append each element to list', async () => {
|
|
|
|
|
await db.listAppend('arrayListAppend', ['a', 'b', 'c']);
|
|
|
|
|
let values = await db.getListRange('arrayListAppend', 0, -1);
|
|
|
|
|
assert.deepStrictEqual(values, ['a', 'b', 'c']);
|
|
|
|
|
|
|
|
|
|
await db.listAppend('arrayListAppend', ['d', 'e']);
|
|
|
|
|
values = await db.getListRange('arrayListAppend', 0, -1);
|
|
|
|
|
assert.deepStrictEqual(values, ['a', 'b', 'c', 'd', 'e']);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('listPrepend()', () => {
|
|
|
|
@ -52,6 +62,16 @@ describe('List methods', () => {
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should prepend each element to list', async () => {
|
|
|
|
|
await db.listPrepend('arrayListPrepend', ['a', 'b', 'c']);
|
|
|
|
|
let values = await db.getListRange('arrayListPrepend', 0, -1);
|
|
|
|
|
assert.deepStrictEqual(values, ['c', 'b', 'a']);
|
|
|
|
|
|
|
|
|
|
await db.listPrepend('arrayListPrepend', ['d', 'e']);
|
|
|
|
|
values = await db.getListRange('arrayListPrepend', 0, -1);
|
|
|
|
|
assert.deepStrictEqual(values, ['e', 'd', 'c', 'b', 'a']);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('getListRange()', () => {
|
|
|
|
|