@@ -48,7 +48,7 @@ describe("simpledb", function () {
4848 // We aren't specifying a models directory and the default models directory doesn't exist so this
4949 // should fail with a "readdir" error.
5050 should . exist ( err ) ;
51- [ 'ENOENT, readdir' , 'ENOENT, scandir' ] . should . include ( err . message . substr ( 0 , 15 ) ) ;
51+ [ 'ENOENT, readdir' , 'ENOENT, scandir' , 'ENOENT: no such' ] . should . include ( err . message . substr ( 0 , 15 ) ) ;
5252 done ( ) ;
5353 } ) ;
5454 } ) ;
@@ -58,7 +58,7 @@ describe("simpledb", function () {
5858 // We aren't specifying a models directory and the default models directory doesn't exist so this
5959 // should fail with a "readdir" error.
6060 should . exist ( err ) ;
61- [ 'ENOENT, readdir' , 'ENOENT, scandir' ] . should . include ( err . message . substr ( 0 , 15 ) ) ;
61+ [ 'ENOENT, readdir' , 'ENOENT, scandir' , 'ENOENT: no such' ] . should . include ( err . message . substr ( 0 , 15 ) ) ;
6262 done ( ) ;
6363 } ) ;
6464 } ) ;
@@ -194,6 +194,30 @@ describe("simpledb", function () {
194194
195195 } ) ;
196196
197+ it ( "should correct work with pre and post hooks" , function ( done ) {
198+
199+ simpledb . init ( options , function ( err , db ) {
200+
201+ var author = new db . Author ( {
202+ name : {
203+ first : 'Alex' ,
204+ last : 'Ford'
205+ } ,
206+ birthday : new Date ( '3/2/1987' )
207+ } ) ;
208+ author . updateCounter . should . equal ( 0 ) ;
209+ author . save ( ) ;
210+
211+ db . Author . findOne ( function ( err , record ) {
212+ record . updateCounter . should . equal ( 1 ) ;
213+ done ( ) ;
214+ } ) ;
215+
216+ } ) ;
217+
218+
219+ } ) ;
220+
197221 it ( "should correct set settings of mongoose-auto-increment plugin" , function ( done ) {
198222
199223 var localOptions = extend ( { } , options , { modelsDir : path . join ( __dirname , 'pluginsmodels' ) , autoIncrementSettings : { startAt : 5 , field : 'id' } } ) ;
0 commit comments