-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close dbs #167
Close dbs #167
Changes from 7 commits
70e64ae
b49e6a3
fc7dcd1
40a11a2
e685ce7
060abde
6b3090e
deb5e5e
77fe1c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,16 +42,19 @@ module.exports.args = function (test) { | |
}) | ||
|
||
test('test custom _serialize*', function (t) { | ||
t.plan(2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
var db = leveldown(testCommon.location()) | ||
db._serializeKey = function (data) { return data } | ||
db._del = function (key, options, callback) { | ||
t.deepEqual(key, { foo: 'bar' }) | ||
callback() | ||
process.nextTick(callback) | ||
} | ||
db.open(function () { | ||
db.del({ foo: 'bar' }, function (err) { | ||
t.error(err) | ||
db.close(function (err) { | ||
t.error(err) | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
@@ -63,7 +66,7 @@ module.exports.del = function (test) { | |
t.error(err) | ||
db.del('foo', function (err) { | ||
t.error(err) | ||
db.get('foo', function (err) { | ||
db.get('foo', function (err, value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woa, nice catch. |
||
t.ok(err, 'entry propertly deleted') | ||
t.ok(typeof value === 'undefined', 'value is undefined') | ||
t.ok(verifyNotFoundError(err), 'NotFound error') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,16 +43,19 @@ module.exports.args = function (test) { | |
}) | ||
|
||
test('test custom _serialize*', function (t) { | ||
t.plan(2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
var db = leveldown(testCommon.location()) | ||
db._serializeKey = function (data) { return data } | ||
db._get = function (key, options, callback) { | ||
t.deepEqual(key, { foo: 'bar' }) | ||
callback() | ||
process.nextTick(callback) | ||
} | ||
db.open(function () { | ||
db.get({ foo: 'bar' }, function (err) { | ||
t.error(err) | ||
db.close(function (err) { | ||
t.error(err) | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ var lastLocation = function () { | |
} | ||
|
||
var cleanup = function (callback) { | ||
if (process.browser) { return callback() } | ||
if (process.browser) { return process.nextTick(callback) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
fs.readdir(__dirname, function (err, list) { | ||
if (err) return callback(err) | ||
|
@@ -27,7 +27,8 @@ var cleanup = function (callback) { | |
var ret = 0 | ||
|
||
list.forEach(function (f) { | ||
rimraf(path.join(__dirname, f), function () { | ||
rimraf(path.join(__dirname, f), function (err) { | ||
if (err) return callback(err) | ||
if (++ret === list.length) { callback() } | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 on removing
t.plan(3)
because it asserts thatdb._approximateSize
is indeed called.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'll fix.