@@ -19,7 +19,6 @@ function runSuite (factory) {
1919 factory : factory ,
2020
2121 // Unsupported features
22- seek : false ,
2322 createIfMissing : false ,
2423 errorIfExists : false ,
2524
@@ -73,7 +72,6 @@ suite({
7372 return subdb ( levelup ( encoding ( memdown ( ) ) ) , 'test' )
7473 } ,
7574 // Unsupported features
76- seek : false ,
7775 createIfMissing : false ,
7876 errorIfExists : false ,
7977
@@ -133,6 +131,38 @@ test('SubDown constructor', function (t) {
133131} )
134132
135133test ( 'SubDb main function' , function ( t ) {
134+ t . test ( 'inherits manifest from parent db' , function ( t ) {
135+ var down = memdown ( )
136+ down . supports . foo = true
137+
138+ var up = levelup ( down )
139+ t . is ( up . supports . foo , true , 'levelup inherits from down' )
140+ up . supports . bar = true
141+
142+ var sub = subdb ( up )
143+ t . is ( sub . supports . foo , true , 'subdb inherits from down via levelup' )
144+ t . is ( sub . supports . seek , true , 'subdb inherits from down via levelup' )
145+ t . is ( sub . supports . bar , true , 'subdb inherits from levelup' )
146+ t . end ( )
147+ } )
148+
149+ t . test ( 'does not support additionalMethods' , function ( t ) {
150+ var down = memdown ( )
151+ down . supports . additionalMethods . foo = true
152+
153+ // We're expecting that levelup exposes the additionalMethod
154+ var up = levelup ( down )
155+ t . is ( up . supports . additionalMethods . foo , true )
156+ t . is ( typeof up . foo , 'function' , 'levelup exposes method' )
157+
158+ // But that subdb removes it (although it is itself a levelup)
159+ // because it can't automatically prefix any key(-like) arguments
160+ var sub = subdb ( up )
161+ t . same ( sub . supports . additionalMethods , { } )
162+ t . is ( typeof sub . foo , 'undefined' , 'subdb does not expose method' )
163+ t . end ( )
164+ } )
165+
136166 t . test ( 'opts.open hook' , function ( t ) {
137167 t . plan ( 1 )
138168 subdb ( levelup ( memdown ( ) ) , 'test' , {
0 commit comments