skiplist: Sanity check inserted entries

This commit is contained in:
Richard Hansen 2021-04-12 01:35:27 -04:00
parent 9e2ef6ad5b
commit e2eb7327c2
4 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,18 @@
'use strict';
const SkipList = require('ep_etherpad-lite/static/js/skiplist');
describe('skiplist.js', function () {
it('rejects null keys', async function () {
const skiplist = new SkipList();
for (const key of [undefined, null]) {
expect(() => skiplist.push({key})).to.throwError();
}
});
it('rejects duplicate keys', async function () {
const skiplist = new SkipList();
skiplist.push({key: 'foo'});
expect(() => skiplist.push({key: 'foo'})).to.throwError();
});
});