-
-
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
Conversation
@@ -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) | |||
}) |
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.
No need to do the .close()
dance here since .open()
is never called.
@@ -68,7 +68,6 @@ module.exports.args = function (test) { | |||
}) | |||
|
|||
test('test custom _serialize*', function (t) { | |||
t.plan(3) |
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 that db._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.
abstract/approximate-size-test.js
Outdated
@@ -79,6 +78,7 @@ module.exports.args = function (test) { | |||
db.open(function () { | |||
db.approximateSize({ foo: 'bar' }, { beep: 'boop' }, function (err) { | |||
t.error(err) | |||
db.close(t.end.bind(t)) |
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.
Maybe instead do:
db.close(function(err) {
t.ifError(err)
})
(and update the plan count to 4)
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.
Ah sorry I commented on an outdated commit. You already added the close callback.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -66,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 comment
The reason will be displayed to describe this comment to others. Learn more.
Woa, nice catch.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
} | ||
db.put({}, {}, function (err, val) { | ||
t.error(err) | ||
}) | ||
}) | ||
|
||
test('test custom _serialize*', function (t) { | ||
t.plan(3) |
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.
Same.
|
865239e
to
77fe1c7
Compare
Resolves #151
WIP Do not merge.Testing this branch in Level/leveldown#415