@@ -589,12 +589,25 @@ describe('Request', function() {
589589 request . runQuery ( { } , options , assert . ifError ) ;
590590 } ) ;
591591
592+ it ( 'should clone the query' , function ( done ) {
593+ var query = new FakeQuery ( ) ;
594+ query . namespace = 'namespace' ;
595+ query = extend ( true , new FakeQuery ( ) , query ) ;
596+
597+ overrides . entity . queryToQueryProto = function ( query_ ) {
598+ assert . notStrictEqual ( query_ , query ) ;
599+ assert . deepEqual ( query_ , query ) ;
600+ done ( ) ;
601+ } ;
602+
603+ request . runQuery ( query , assert . ifError ) ;
604+ } ) ;
605+
592606 it ( 'should make correct request' , function ( done ) {
593607 var query = { namespace : 'namespace' } ;
594608 var queryProto = { } ;
595609
596- overrides . entity . queryToQueryProto = function ( query_ ) {
597- assert . strictEqual ( query_ , query ) ;
610+ overrides . entity . queryToQueryProto = function ( ) {
598611 return queryProto ;
599612 } ;
600613
@@ -693,7 +706,6 @@ describe('Request', function() {
693706 } ) ;
694707
695708 it ( 'should re-run query if not finished' , function ( done ) {
696- var continuationQuery ;
697709 var query = {
698710 limitVal : 1 ,
699711 offsetVal : 8
@@ -769,7 +781,7 @@ describe('Request', function() {
769781
770782 overrides . entity . queryToQueryProto = function ( query_ ) {
771783 if ( timesRequestCalled > 1 ) {
772- assert . strictEqual ( query_ , continuationQuery ) ;
784+ assert . strictEqual ( query_ , query ) ;
773785 }
774786 return queryProto ;
775787 } ;
0 commit comments