diff --git a/lib/mock.js b/lib/mock.js index d1b3195..1d77586 100644 --- a/lib/mock.js +++ b/lib/mock.js @@ -84,7 +84,13 @@ const storage = {}; // Root storage. Object.defineProperty(this, 'version', { value: version, enumerable: true }); Object.defineProperty(this, 'objectStoreNames', { enumerable: true, - get() { const names = Object.keys(data); names.sort(); return names; }, + get() { + const names = Object.keys(data); + names.sort(); + // Fake contains from DOMStringList + names.contains = (valueTest) => names.indexOf(valueTest) !== -1; + return names; + }, set() { throw new Error('IDBDatabase: _data is read only'); } }); Object.defineProperty(this, '_data', { @@ -1563,4 +1569,4 @@ module.exports.validKey = validKey; module.exports.validKeyRange = validKeyRange; module.exports.keyInRange = keyInRange; module.exports.clone = clone; -module.exports.reset = reset; \ No newline at end of file +module.exports.reset = reset;