You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB

4 years ago
var concat = require('level-concat-iterator')
module.exports = function (test, testCommon) {
test('setUp common', testCommon.setUp)
test('testCommon.factory() returns a unique database', function (t) {
var db1 = testCommon.factory()
var db2 = testCommon.factory()
function close () {
db1.close(function (err) {
t.error(err, 'no error while closing db1')
db2.close(function (err) {
t.error(err, 'no error while closing db2')
t.end()
})
})
}
db1.open(function (err) {
t.error(err, 'no error while opening db1')
db2.open(function (err) {
t.error(err, 'no error while opening db2')
db1.put('key', 'value', function (err) {
t.error(err, 'put key in db1')
concat(db2.iterator(), function (err, entries) {
t.error(err, 'got items from db2')
t.same(entries, [], 'db2 should be empty')
close()
})
})
})
})
})
test('tearDown', testCommon.tearDown)
}