Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
add promise error handling test
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Aug 26, 2017
1 parent 41bd624 commit 8b1693e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/get-put-del-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ buster.testCase('get() / put() / del()', {
})
},

'get() on empty database raises promise error': function (done) {
this.openTestDatabase(function (db) {
db.get('undefkey').catch(function (err) {
assert.isInstanceOf(err, Error)
assert.isInstanceOf(err, errors.LevelUPError)
assert.isInstanceOf(err, errors.NotFoundError)
assert(err.notFound === true, 'err.notFound is `true`')
assert.equals(err.status, 404, 'err.status is 404')
assert.match(err, '[undefkey]')
done()
})
})
},

'put() and get() simple string key/value pairs': function (done) {
this.openTestDatabase(function (db) {
db.put('some key', 'some value stored in the database', function (err) {
Expand Down

0 comments on commit 8b1693e

Please sign in to comment.