diff --git a/test/node/ol/Collection.test.js b/test/node/ol/Collection.test.js index 6723172706..bbef014f6e 100644 --- a/test/node/ol/Collection.test.js +++ b/test/node/ol/Collection.test.js @@ -5,6 +5,7 @@ import sinon from 'sinon'; import {listen} from '../../../src/ol/events.js'; describe('ol/Collection.js', function () { + /** @type {Collection} */ let collection; beforeEach(function () { @@ -86,6 +87,13 @@ describe('ol/Collection.js', function () { expect(collection.item(0)).to.eql(0); expect(collection.item(1)).to.eql(2); }); + it('does not fire event for invalid index', function () { + const collection = new Collection([0, 1, 2]); + collection.on('remove', function () { + throw new Error('Should not fire event for invalid index'); + }); + expect(collection.removeAt(3)).to.be(undefined); + }); }); describe('forEach', function () {