@@ -130,7 +130,14 @@ describe("Hook", function() {
130130 should . exist ( people ) ;
131131 should . equal ( people . length , 1 ) ;
132132 should . equal ( people [ 0 ] . name , "Hook Worked" ) ;
133- done ( ) ;
133+
134+ // garantee it was correctly saved on database
135+ Person . one ( { name : "Hook Worked" } , function ( err , person ) {
136+ should . not . exist ( err ) ;
137+ should . exist ( person ) ;
138+
139+ return done ( ) ;
140+ } ) ;
134141 } ) ;
135142 } ) ;
136143
@@ -150,9 +157,9 @@ describe("Hook", function() {
150157 items [ 0 ] . name . should . equal ( "Jane Doe" ) ;
151158
152159 // ensure it was really saved
153- Person . get ( items [ 0 ] [ Person . id ] , function ( err , Item ) {
154- should . equal ( err , null ) ;
155- Item . name . should . equal ( "Jane Doe" ) ;
160+ Person . find ( { name : "Hook Worked" } , { cache : false } , 1 , function ( err , people ) {
161+ should . not . exist ( err ) ;
162+ should ( Array . isArray ( people ) ) ;
156163
157164 return done ( ) ;
158165 } ) ;
@@ -243,7 +250,14 @@ describe("Hook", function() {
243250 should . exist ( people ) ;
244251 should . equal ( people . length , 1 ) ;
245252 should . equal ( people [ 0 ] . name , "Hook Worked" ) ;
246- done ( ) ;
253+
254+ // garantee it was correctly saved on database
255+ Person . find ( { name : "Hook Worked" } , { cache : false } , 1 , function ( err , people ) {
256+ should . not . exist ( err ) ;
257+ should ( Array . isArray ( people ) ) ;
258+
259+ return done ( ) ;
260+ } ) ;
247261 } ) ;
248262 } ) ;
249263
0 commit comments