@@ -15,7 +15,7 @@ module.exports = function (test, testCommon) {
1515 t . ifError ( err )
1616
1717 each ( [ 'foo' , 'bar' , 'baz' ] , function ( key , next ) {
18- db . get ( key , function ( err , value ) {
18+ db . get ( key , { asBuffer : false } , function ( err , value ) {
1919 t . ifError ( err )
2020 t . is ( value , 'a' + key + 'value' )
2121 next ( )
@@ -25,7 +25,7 @@ module.exports = function (test, testCommon) {
2525 } )
2626 } )
2727
28- test ( 'array-form batch(): promise interface' , function ( t ) {
28+ testCommon . promises && test ( 'array-form batch(): promise interface' , function ( t ) {
2929 discardable ( t , testCommon , function ( db , done ) {
3030 db . batch ( [
3131 { type : 'put' , key : 'foo' , value : 'afoovalue' } ,
@@ -34,7 +34,7 @@ module.exports = function (test, testCommon) {
3434 ] )
3535 . then ( function ( ) {
3636 each ( [ 'foo' , 'bar' , 'baz' ] , function ( key , next ) {
37- db . get ( key , function ( err , value ) {
37+ db . get ( key , { asBuffer : false } , function ( err , value ) {
3838 t . ifError ( err )
3939 t . is ( value , 'a' + key + 'value' )
4040 next ( )
@@ -67,7 +67,7 @@ module.exports = function (test, testCommon) {
6767 function ( next ) {
6868 // these should exist
6969 each ( [ '2' , '3' , 'bar' , 'baz' ] , function ( key , next ) {
70- db . get ( key , function ( err , value ) {
70+ db . get ( key , { asBuffer : false } , function ( err , value ) {
7171 t . ifError ( err )
7272 t . ok ( value != null )
7373 next ( )
@@ -77,7 +77,7 @@ module.exports = function (test, testCommon) {
7777 function ( next ) {
7878 // these shouldn't exist
7979 each ( [ '1' , 'foo' ] , function ( key , next ) {
80- db . get ( key , function ( err , value ) {
80+ db . get ( key , { asBuffer : false } , function ( err , value ) {
8181 t . ok ( err )
8282 t . ok ( err instanceof errors . NotFoundError )
8383 t . is ( value , undefined )
@@ -107,7 +107,7 @@ module.exports = function (test, testCommon) {
107107 t . ifError ( err )
108108
109109 each ( [ 'one' , 'three' , '1' , '2' , '3' ] , function ( key , next ) {
110- db . get ( key , function ( err ) {
110+ db . get ( key , { asBuffer : false } , function ( err ) {
111111 if ( [ 'one' , 'three' , '1' , '3' ] . indexOf ( key ) > - 1 ) {
112112 t . ok ( err )
113113 } else {
@@ -125,9 +125,11 @@ module.exports = function (test, testCommon) {
125125 test ( 'chained batch(): options' , function ( t ) {
126126 discardable ( t , testCommon , function ( db , done ) {
127127 var batch = db . batch ( )
128+ var underlying = batch
129+ while ( underlying . batch ) underlying = underlying . batch
128130
129- var write = batch . batch . write . bind ( batch . batch )
130- batch . batch . write = function ( options , cb ) {
131+ var write = underlying . write . bind ( underlying )
132+ underlying . write = function ( options , cb ) {
131133 t . same ( options , { foo : 'bar' } )
132134 write ( options , cb )
133135 }
@@ -140,7 +142,7 @@ module.exports = function (test, testCommon) {
140142 } )
141143 } )
142144
143- test ( 'chained batch(): promise interface - options' , function ( t ) {
145+ testCommon . promises && test ( 'chained batch(): promise interface - options' , function ( t ) {
144146 discardable ( t , testCommon , function ( db , done ) {
145147 var batch = db . batch ( )
146148
@@ -157,7 +159,7 @@ module.exports = function (test, testCommon) {
157159 } )
158160 } )
159161
160- test ( 'chained batch(): promise interface' , function ( t ) {
162+ testCommon . promises && test ( 'chained batch(): promise interface' , function ( t ) {
161163 discardable ( t , testCommon , function ( db , done ) {
162164 db . put ( '1' , 'one' , function ( err ) {
163165 t . ifError ( err )
@@ -174,7 +176,7 @@ module.exports = function (test, testCommon) {
174176 . write ( )
175177 . then ( function ( ) {
176178 each ( [ 'one' , 'three' , '1' , '2' , '3' ] , function ( key , next ) {
177- db . get ( key , function ( err ) {
179+ db . get ( key , { asBuffer : false } , function ( err ) {
178180 if ( [ 'one' , 'three' , '1' , '3' ] . indexOf ( key ) > - 1 ) {
179181 t . ok ( err )
180182 } else {
@@ -228,7 +230,7 @@ module.exports = function (test, testCommon) {
228230 function ( next ) {
229231 // these should exist
230232 each ( [ '2' , '3' , 'bar' , 'baz' ] , function ( key , next ) {
231- db . get ( key , function ( err , value ) {
233+ db . get ( key , { asBuffer : false } , function ( err , value ) {
232234 t . ifError ( err )
233235 t . ok ( value != null )
234236 next ( )
@@ -238,7 +240,7 @@ module.exports = function (test, testCommon) {
238240 function ( next ) {
239241 // these shouldn't exist
240242 each ( [ '1' , 'foo' ] , function ( key , next ) {
241- db . get ( key , function ( err , value ) {
243+ db . get ( key , { asBuffer : false } , function ( err , value ) {
242244 t . ok ( err )
243245 t . ok ( err instanceof errors . NotFoundError )
244246 t . is ( value , undefined )
@@ -264,7 +266,7 @@ module.exports = function (test, testCommon) {
264266 function ( next ) {
265267 // these should exist
266268 each ( [ '2' , '3' ] , function ( key , next ) {
267- db . get ( key , function ( err , value ) {
269+ db . get ( key , { asBuffer : false } , function ( err , value ) {
268270 t . ifError ( err )
269271 t . ok ( value != null )
270272 next ( )
@@ -273,7 +275,7 @@ module.exports = function (test, testCommon) {
273275 } ,
274276 function ( next ) {
275277 // this shouldn't exist
276- db . get ( '1' , function ( err , value ) {
278+ db . get ( '1' , { asBuffer : false } , function ( err , value ) {
277279 t . ok ( err )
278280 t . ok ( err instanceof errors . NotFoundError )
279281 t . is ( value , undefined )
0 commit comments