Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit 121e4b3

Browse files
committed
Relax isAbstract check in tests (closes #125)
To deal with a node_modules tree that has multiple versions of abstract-leveldown, and those versions having a different API.
1 parent ed28383 commit 121e4b3

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

test/suite.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
'use strict'
22

33
var test = require('tape')
4-
var abstract = require('abstract-leveldown')
54

6-
function isAbstract (db) {
5+
function isLooseAbstract (db) {
76
if (!db || typeof db !== 'object') { return false }
8-
return Object.keys(abstract.AbstractLevelDOWN.prototype).filter(function (name) {
9-
return name[0] !== '_'
10-
}).every(function (name) {
11-
return typeof db[name] === 'function'
12-
})
7+
return typeof db._batch === 'function' && typeof db._iterator === 'function'
138
}
149

1510
function down (db, type) {
1611
if (typeof db.down === 'function') return db.down(type)
1712
if (type && db.type === type) return db
18-
if (isAbstract(db.db)) return down(db.db, type)
19-
if (isAbstract(db._db)) return down(db._db, type)
13+
if (isLooseAbstract(db.db)) return down(db.db, type)
14+
if (isLooseAbstract(db._db)) return down(db._db, type)
2015
return type ? null : db
2116
}
2217

0 commit comments

Comments
 (0)