Skip to content
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

Merged
merged 9 commits into from
Dec 23, 2017
Merged

Close dbs #167

merged 9 commits into from
Dec 23, 2017

Conversation

ralphtheninja
Copy link
Member

@ralphtheninja ralphtheninja commented Dec 23, 2017

Resolves #151

WIP Do not merge.

Testing this branch in Level/leveldown#415

@@ -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)
})
Copy link
Member Author

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)
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll fix.

@@ -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))
Copy link
Member

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)

Copy link
Member

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) }
Copy link
Member

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)
Copy link
Member

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) {
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

@ralphtheninja
Copy link
Member Author

ralphtheninja commented Dec 23, 2017

Gah, missed one t.plan() updating.

@ralphtheninja ralphtheninja merged commit d3a4022 into master Dec 23, 2017
@ralphtheninja ralphtheninja deleted the close-dbs branch December 23, 2017 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants