mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 18:06:15 -04:00
skiplist: Sanity check inserted entries
This commit is contained in:
parent
9e2ef6ad5b
commit
e2eb7327c2
4 changed files with 29 additions and 0 deletions
18
src/tests/frontend/specs/skiplist.js
Normal file
18
src/tests/frontend/specs/skiplist.js
Normal 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();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue