subleveldown
Advanced tools
Comparing version 3.0.0-rc1 to 3.0.0
@@ -5,5 +5,17 @@ # Changelog | ||
## [v3.0.0-rc1] | ||
## [3.0.0] - 2018-06-07 | ||
### Added | ||
* Test that iterator options are forwarded (@ralphtheninja) | ||
* Test concatenating Buffer keys (@ralphtheninja) | ||
### Changed | ||
* Call `cleanup()` cb synchronously (@ralphtheninja) | ||
### Removed | ||
* Remove `makeExistingDbTest()` from `test/common.js` (@ralphtheninja) | ||
## [3.0.0-rc1] - 2018-06-03 | ||
### Changed | ||
* Upgrade `levelup` from `^1.2.1` to `^3.0.1` (@ralphtheninja) | ||
@@ -106,3 +118,4 @@ * Upgrade `abstract-leveldown` from `^2.4.1` to `^5.0.0` (@ralphtheninja) | ||
[Unreleased]: https://github.com/level/subleveldown/compare/v3.0.0-rc1...HEAD | ||
[Unreleased]: https://github.com/level/subleveldown/compare/v3.0.0...HEAD | ||
[3.0.0]: https://github.com/level/subleveldown/compare/v3.0.0-rc1...v3.0.0 | ||
[3.0.0-rc1]: https://github.com/level/subleveldown/compare/v2.1.0...v3.0.0-rc1 | ||
@@ -109,0 +122,0 @@ [2.1.0]: https://github.com/level/subleveldown/compare/v2.0.0...v2.1.0 |
{ | ||
"name": "subleveldown", | ||
"version": "3.0.0-rc1", | ||
"version": "3.0.0", | ||
"description": "sublevels implemented using leveldowns", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,4 +9,3 @@ var dbidx = 0 | ||
tearDown: tearDown, | ||
collectEntries: collectEntries, | ||
makeExistingDbTest: makeExistingDbTest | ||
collectEntries: collectEntries | ||
} | ||
@@ -23,3 +22,3 @@ | ||
function cleanup (callback) { | ||
callback() | ||
process.nextTick(callback) | ||
} | ||
@@ -55,30 +54,1 @@ | ||
} | ||
function makeExistingDbTest (name, test, leveldown, testFn) { | ||
test(name, function (t) { | ||
cleanup(function () { | ||
var loc = location() | ||
var db = leveldown(loc) | ||
db.open(function (err) { | ||
t.notOk(err, 'no error from open()') | ||
db.batch([ | ||
{type: 'put', key: 'one', value: '1'}, | ||
{type: 'put', key: 'two', value: '2'}, | ||
{type: 'put', key: 'three', value: '3'} | ||
], function (err) { | ||
t.notOk(err, 'no error from batch()') | ||
testFn(db, t, done, loc) | ||
}) | ||
}) | ||
function done (close) { | ||
if (close === false) return cleanup(t.end.bind(t)) | ||
db.close(function (err) { | ||
t.notOk(err, 'no error from close()') | ||
cleanup(t.end.bind(t)) | ||
}) | ||
} | ||
}) | ||
}) | ||
} |
@@ -141,2 +141,35 @@ var test = require('tape') | ||
}) | ||
t.test('iterator options are forwarded (issue #1)', function (t) { | ||
t.plan(4) | ||
var enc = { keyEncoding: 'utf8', valueEncoding: 'json' } | ||
var db = levelup(encoding(memdown(), enc)) | ||
var sub = subdb(db, 'test', enc) | ||
var key = 'foo' | ||
var value = { hello: 'world' } | ||
sub.once('open', function () { | ||
sub.put(key, value, function () { | ||
db.createReadStream().on('data', function (r) { | ||
t.is(r.key, '!test!' + key, 'db key is utf8') | ||
t.deepEqual(r.value, value, 'db value is json') | ||
}) | ||
sub.createReadStream().on('data', function (r) { | ||
t.is(r.key, key, 'sub db key is utf8') | ||
t.deepEqual(r.value, value, 'db value is json') | ||
}) | ||
}) | ||
}) | ||
}) | ||
t.test('concatenating Buffer keys', function (t) { | ||
t.plan(1) | ||
var db = levelup(memdown()) | ||
var sub = subdb(db, 'test', { keyEncoding: 'binary' }) | ||
var key = Buffer.from('00ff', 'hex') | ||
sub.once('open', function () { | ||
sub.put(key, 'bar', function () { | ||
db.createReadStream().on('data', function (r) { | ||
t.deepEqual(r.key, Buffer.concat([Buffer.from('!test!'), key])) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
@@ -143,0 +176,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24856
367
0
0