Browse files

test that batches error correctly when passed null

  • Loading branch information...
1 parent 2e01118 commit 77642f13253bd2f9f21b0d1ee04c6e2836a31fc0 @dominictarr dominictarr committed with rvagg Mar 9, 2013
Showing with 32 additions and 0 deletions.
  1. +32 −0 test/simple-test.js
View
32 test/simple-test.js
@@ -558,5 +558,37 @@ buster.testCase('Basic API', {
done()
})
}
+ , 'batch() with undefined value causes error': function (done) {
+ this.db.batch([{key: 'foo', value: undefined, type: 'put'}]
+ , function (err) {
+ assert.isInstanceOf(err, Error)
+ assert.isInstanceOf(err, errors.LevelUPError)
+ done()
+ })
+ }
+ , 'batch() with null value causes error': function (done) {
+ this.db.batch([{key: 'foo', value: null, type: 'put'}]
+ , function (err) {
+ assert.isInstanceOf(err, Error)
+ assert.isInstanceOf(err, errors.LevelUPError)
+ done()
+ })
+ }
+ , 'batch() with undefined key causes error': function (done) {
+ this.db.batch([{key: undefined, value: 'bar', type: 'put'}]
+ , function (err) {
+ assert.isInstanceOf(err, Error)
+ assert.isInstanceOf(err, errors.LevelUPError)
+ done()
+ })
+ }
+ , 'batch() with null key causes error': function (done) {
+ this.db.batch([{key: null, value: 'bar', type: 'put'}]
+ , function (err) {
+ assert.isInstanceOf(err, Error)
+ assert.isInstanceOf(err, errors.LevelUPError)
+ done()
+ })
+ }
}
})

0 comments on commit 77642f1

Please sign in to comment.