feat: add failing test for list append/prepend with list (#9303)

* feat: add failing test for list append/prepend with list

* feat: mongo/psql

* feat: improve test
This commit is contained in:
Barış Soner Uşaklı
2021-02-14 11:12:56 -05:00
committed by GitHub
parent b5b92768e2
commit 8f0386d9ac
3 changed files with 89 additions and 25 deletions

View File

@@ -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()', () => {