Skip to content

Commit

Permalink
close db in custom _serialize test in put-test.js + fix zalgo
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed Dec 23, 2017
1 parent 6b3090e commit deb5e5e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions abstract/put-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,28 @@ module.exports.args = function (test) {
db._put = function (key, value, opts, callback) {
t.ok(key)
t.ok(value)
callback()
process.nextTick(callback)
}
db.put({}, {}, function (err, val) {
t.error(err)
})
})

test('test custom _serialize*', function (t) {
t.plan(3)
var db = leveldown(testCommon.location())
db._serializeKey = db._serializeValue = function (data) { return data }
db._put = function (key, value, options, callback) {
t.deepEqual(key, { foo: 'bar' })
t.deepEqual(value, { beep: 'boop' })
callback()
process.nextTick(callback)
}
db.open(function () {
db.put({ foo: 'bar' }, { beep: 'boop' }, function (err) {
t.error(err)
db.close(function (err) {
t.error(err)
t.end()
})
})
})
})
Expand Down

0 comments on commit deb5e5e

Please sign in to comment.