@@ -223,10 +223,10 @@ describe('DeltaSnapshot', () => {
223223 let count = 0 ;
224224 let counter = snap => count ++ ;
225225
226- subject . forEach ( counter ) ;
226+ expect ( subject . forEach ( counter ) ) . to . equal ( false ) ;
227227 populate ( 23 , null ) ;
228228
229- subject . forEach ( counter ) ;
229+ expect ( subject . forEach ( counter ) ) . to . equal ( false ) ;
230230 expect ( count ) . to . eq ( 0 ) ;
231231 } ) ;
232232
@@ -243,13 +243,21 @@ describe('DeltaSnapshot', () => {
243243 expect ( ret ) . to . equal ( true ) ;
244244 } ) ;
245245
246- it ( 'should not cancel further enumeration if callback does not return true' , ( ) => {
246+ it ( 'should not cancel further enumeration if callback returns a truthy value' , ( ) => {
247+ populate ( null , { a : 'b' , c : 'd' , e : 'f' , g : 'h' } ) ;
248+ let out = '' ;
249+ const ret = subject . forEach ( snap => {
250+ out += snap . val ( ) ;
251+ return 1 ;
252+ } ) ;
253+ expect ( out ) . to . equal ( 'bdfh' ) ;
254+ expect ( ret ) . to . equal ( false ) ;
255+ } ) ;
256+
257+ it ( 'should not cancel further enumeration if callback does not return' , ( ) => {
247258 populate ( null , { a : 'b' , c : 'd' , e : 'f' , g : 'h' } ) ;
248259 let out = '' ;
249260 const ret = subject . forEach ( snap => {
250- if ( snap . val ( ) === 'a' ) {
251- return true ;
252- }
253261 out += snap . val ( ) ;
254262 } ) ;
255263 expect ( out ) . to . equal ( 'bdfh' ) ;
0 commit comments