fix: Resolve TypeScript errors
Signed-off-by: Hermes Agent <hermes@nosuchhost>
This commit is contained in:
53
client/node_modules/level-packager/abstract/base-test.js
generated
vendored
Normal file
53
client/node_modules/level-packager/abstract/base-test.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict'
|
||||
|
||||
var location = require('./location')
|
||||
|
||||
module.exports = function (test, level) {
|
||||
test('test db open and use, level(location, cb)', function (t) {
|
||||
level(location, function (err, db) {
|
||||
t.notOk(err, 'no error')
|
||||
db.put('test1', 'success', function (err) {
|
||||
t.notOk(err, 'no error')
|
||||
db.close(t.end.bind(t))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('test db open and use, level(location, options, cb)', function (t) {
|
||||
level(location, { createIfMissing: false, errorIfExists: false }, function (err, db) {
|
||||
t.notOk(err, 'no error')
|
||||
db.put('test2', 'success', function (err) {
|
||||
t.notOk(err, 'no error')
|
||||
db.close(t.end.bind(t))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('test db open and use, db=level(location)', function (t) {
|
||||
var db = level(location)
|
||||
db.put('test3', 'success', function (err) {
|
||||
t.notOk(err, 'no error')
|
||||
db.close(t.end.bind(t))
|
||||
})
|
||||
})
|
||||
|
||||
test('options.keyEncoding and options.valueEncoding are passed on to encoding-down', function (t) {
|
||||
var db = level(location, { keyEncoding: 'json', valueEncoding: 'json' })
|
||||
db.on('ready', function () {
|
||||
var codec = db.db.codec
|
||||
t.equal(codec.opts.keyEncoding, 'json', 'keyEncoding correct')
|
||||
t.equal(codec.opts.valueEncoding, 'json', 'valueEncoding correct')
|
||||
db.close(t.end.bind(t))
|
||||
})
|
||||
})
|
||||
|
||||
test('encoding options default to utf8', function (t) {
|
||||
var db = level(location)
|
||||
db.on('ready', function () {
|
||||
var codec = db.db.codec
|
||||
t.equal(codec.opts.keyEncoding, 'utf8', 'keyEncoding correct')
|
||||
t.equal(codec.opts.valueEncoding, 'utf8', 'valueEncoding correct')
|
||||
db.close(t.end.bind(t))
|
||||
})
|
||||
})
|
||||
}
|
||||
30
client/node_modules/level-packager/abstract/db-values-test.js
generated
vendored
Normal file
30
client/node_modules/level-packager/abstract/db-values-test.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
var location = require('./location')
|
||||
|
||||
module.exports = function (test, level, nonPersistent) {
|
||||
test('test db values', function (t) {
|
||||
var c = 0
|
||||
var db = level(location)
|
||||
var setup = nonPersistent ? function (callback) {
|
||||
db.batch([
|
||||
{ type: 'put', key: 'test1', value: 'success' },
|
||||
{ type: 'put', key: 'test2', value: 'success' },
|
||||
{ type: 'put', key: 'test3', value: 'success' }
|
||||
], callback)
|
||||
} : function (callback) { callback() }
|
||||
|
||||
function read (err, value) {
|
||||
t.notOk(err, 'no error')
|
||||
t.equal(value, 'success')
|
||||
if (++c === 3) { db.close(t.end.bind(t)) }
|
||||
}
|
||||
|
||||
setup(function (err) {
|
||||
t.notOk(err, 'no error')
|
||||
db.get('test1', read)
|
||||
db.get('test2', read)
|
||||
db.get('test3', read)
|
||||
})
|
||||
})
|
||||
}
|
||||
17
client/node_modules/level-packager/abstract/destroy-test.js
generated
vendored
Normal file
17
client/node_modules/level-packager/abstract/destroy-test.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var location = require('./location')
|
||||
|
||||
module.exports = function (test, level) {
|
||||
test('test destroy', function (t) {
|
||||
t.plan(4)
|
||||
t.ok(fs.statSync(location).isDirectory(), 'sanity check, directory exists')
|
||||
t.ok(fs.existsSync(path.join(location, 'CURRENT')), 'sanity check, CURRENT exists')
|
||||
level.destroy(location, function (err) {
|
||||
t.notOk(err, 'no error')
|
||||
t.notOk(fs.existsSync(path.join(location, 'CURRENT')), 'db gone (mostly)')
|
||||
})
|
||||
})
|
||||
}
|
||||
13
client/node_modules/level-packager/abstract/error-if-exists-test.js
generated
vendored
Normal file
13
client/node_modules/level-packager/abstract/error-if-exists-test.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
var location = require('./location')
|
||||
|
||||
module.exports = function (test, level) {
|
||||
test('test db open and use, level(location, options, cb) force error', function (t) {
|
||||
level(location, { errorIfExists: true }, function (err, db) {
|
||||
t.ok(err, 'got error opening existing db')
|
||||
t.notOk(db, 'no db')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
}
|
||||
3
client/node_modules/level-packager/abstract/location.js
generated
vendored
Normal file
3
client/node_modules/level-packager/abstract/location.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var path = require('path')
|
||||
|
||||
module.exports = path.join(__dirname, 'level-test-' + process.pid + '.db')
|
||||
12
client/node_modules/level-packager/abstract/repair-test.js
generated
vendored
Normal file
12
client/node_modules/level-packager/abstract/repair-test.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
var location = require('./location')
|
||||
|
||||
module.exports = function (test, level) {
|
||||
test('test repair', function (t) {
|
||||
t.plan(1)
|
||||
level.repair(location, function (err) {
|
||||
t.notOk(err, 'no error')
|
||||
})
|
||||
})
|
||||
}
|
||||
20
client/node_modules/level-packager/abstract/test.js
generated
vendored
Normal file
20
client/node_modules/level-packager/abstract/test.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (test, level, options) {
|
||||
options = options || {}
|
||||
|
||||
require('./base-test')(test, level)
|
||||
require('./db-values-test')(test, level, options.nonPersistent)
|
||||
|
||||
if (!options.skipErrorIfExistsTest) {
|
||||
require('./error-if-exists-test')(test, level)
|
||||
}
|
||||
|
||||
if (!options.skipRepairTest) {
|
||||
require('./repair-test')(test, level)
|
||||
}
|
||||
|
||||
if (!options.skipDestroyTest) {
|
||||
require('./destroy-test')(test, level)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user