@@ -138,6 +138,7 @@ describe('$firebase', function () {
138138 it ( 'should work on a query' , function ( ) {
139139 var ref = new Firebase ( 'Mock://' ) . child ( 'ordered' ) . limit ( 5 ) ;
140140 var $fb = $firebase ( ref ) ;
141+ spyOn ( ref . ref ( ) , 'push' ) . and . callThrough ( ) ;
141142 flushAll ( ) ;
142143 expect ( ref . ref ( ) . push ) . not . toHaveBeenCalled ( ) ;
143144 $fb . $push ( { foo : 'querytest' } ) ;
@@ -202,6 +203,7 @@ describe('$firebase', function () {
202203 it ( 'should affect query keys only if query used' , function ( ) {
203204 var ref = new Firebase ( 'Mock://' ) . child ( 'ordered' ) . limit ( 1 ) ;
204205 var $fb = $firebase ( ref ) ;
206+ spyOn ( ref . ref ( ) , 'update' ) ;
205207 ref . flush ( ) ;
206208 var expKeys = ref . slice ( ) . keys ;
207209 $fb . $set ( { hello : 'world' } ) ;
@@ -276,6 +278,7 @@ describe('$firebase', function () {
276278 } ) ;
277279
278280 it ( 'should remove data in Firebase' , function ( ) {
281+ spyOn ( $fb . $ref ( ) , 'remove' ) ;
279282 $fb . $remove ( ) ;
280283 flushAll ( ) ;
281284 expect ( $fb . $ref ( ) . remove ) . toHaveBeenCalled ( ) ;
@@ -291,6 +294,9 @@ describe('$firebase', function () {
291294 expect ( origKeys . length ) . toBeGreaterThan ( keys . length ) ;
292295 var $fb = $firebase ( ref ) ;
293296 flushAll ( ref ) ;
297+ origKeys . forEach ( function ( key ) {
298+ spyOn ( ref . ref ( ) . child ( key ) , 'remove' ) ;
299+ } ) ;
294300 $fb . $remove ( ) ;
295301 flushAll ( ref ) ;
296302 keys . forEach ( function ( key ) {
@@ -546,8 +552,10 @@ describe('$firebase', function () {
546552 } ) ;
547553
548554 it ( 'should cancel listeners if destroyFn is invoked' , function ( ) {
549- var arr = $fb . $asArray ( ) ;
550555 var ref = $fb . $ref ( ) ;
556+ spyOn ( ref , 'on' ) . and . callThrough ( ) ;
557+ spyOn ( ref , 'off' ) . and . callThrough ( ) ;
558+ var arr = $fb . $asArray ( ) ;
551559 flushAll ( ) ;
552560 expect ( ref . on ) . toHaveBeenCalled ( ) ;
553561 arr . $$$destroyFn ( ) ;
@@ -651,8 +659,10 @@ describe('$firebase', function () {
651659 } ) ;
652660
653661 it ( 'should cancel listeners if destroyFn is invoked' , function ( ) {
654- var obj = $fb . $asObject ( ) ;
655662 var ref = $fb . $ref ( ) ;
663+ spyOn ( ref , 'on' ) . and . callThrough ( ) ;
664+ spyOn ( ref , 'off' ) . and . callThrough ( ) ;
665+ var obj = $fb . $asObject ( ) ;
656666 flushAll ( ) ;
657667 expect ( ref . on ) . toHaveBeenCalled ( ) ;
658668 obj . $$$destroyFn ( ) ;
@@ -719,4 +729,4 @@ describe('$firebase', function () {
719729 try { $timeout . flush ( ) ; }
720730 catch ( e ) { }
721731 }
722- } ) ;
732+ } ) ;
0 commit comments