@@ -734,7 +734,8 @@ module.exports = function(options) {
734
734
var db = this . db ;
735
735
db . commit ( 'testcollection' , 'test' , { v : 0 , create : { } } , snapshot , null , function ( err ) {
736
736
if ( err ) return done ( err ) ;
737
- db . queryPoll ( 'testcollection' , { x : 5 } , null , function ( err , ids ) {
737
+ var dbQuery = getQuery ( { query : { x : 5 } } ) ;
738
+ db . queryPoll ( 'testcollection' , dbQuery , null , function ( err , ids ) {
738
739
if ( err ) return done ( err ) ;
739
740
expect ( ids ) . eql ( [ 'test' ] ) ;
740
741
done ( ) ;
@@ -743,7 +744,8 @@ module.exports = function(options) {
743
744
} ) ;
744
745
745
746
it ( 'returns nothing when there is no data' , function ( done ) {
746
- this . db . queryPoll ( 'testcollection' , { x : 5 } , null , function ( err , ids ) {
747
+ var dbQuery = getQuery ( { query : { x : 5 } } ) ;
748
+ this . db . queryPoll ( 'testcollection' , dbQuery , null , function ( err , ids ) {
747
749
if ( err ) return done ( err ) ;
748
750
expect ( ids ) . eql ( [ ] ) ;
749
751
done ( ) ;
@@ -753,26 +755,26 @@ module.exports = function(options) {
753
755
754
756
describe ( 'queryPollDoc' , function ( ) {
755
757
it ( 'returns false when the document does not exist' , function ( done ) {
756
- var query = { } ;
757
- if ( ! this . db . canPollDoc ( 'testcollection' , query ) ) return done ( ) ;
758
+ var dbQuery = getQuery ( { query : { } } ) ;
759
+ if ( ! this . db . canPollDoc ( 'testcollection' , dbQuery ) ) return done ( ) ;
758
760
759
761
var db = this . db ;
760
- db . queryPollDoc ( 'testcollection' , 'doesnotexist' , query , null , function ( err , result ) {
762
+ db . queryPollDoc ( 'testcollection' , 'doesnotexist' , dbQuery , null , function ( err , result ) {
761
763
if ( err ) return done ( err ) ;
762
764
expect ( result ) . equal ( false ) ;
763
765
done ( ) ;
764
766
} ) ;
765
767
} ) ;
766
768
767
769
it ( 'returns true when the document matches' , function ( done ) {
768
- var query = { x : 5 } ;
769
- if ( ! this . db . canPollDoc ( 'testcollection' , query ) ) return done ( ) ;
770
+ var dbQuery = getQuery ( { query : { x : 5 } } ) ;
771
+ if ( ! this . db . canPollDoc ( 'testcollection' , dbQuery ) ) return done ( ) ;
770
772
771
773
var snapshot = { type : 'json0' , v : 1 , data : { x : 5 , y : 6 } } ;
772
774
var db = this . db ;
773
775
db . commit ( 'testcollection' , 'test' , { v : 0 , create : { } } , snapshot , null , function ( err ) {
774
776
if ( err ) return done ( err ) ;
775
- db . queryPollDoc ( 'testcollection' , 'test' , query , null , function ( err , result ) {
777
+ db . queryPollDoc ( 'testcollection' , 'test' , dbQuery , null , function ( err , result ) {
776
778
if ( err ) return done ( err ) ;
777
779
expect ( result ) . equal ( true ) ;
778
780
done ( ) ;
@@ -781,14 +783,14 @@ module.exports = function(options) {
781
783
} ) ;
782
784
783
785
it ( 'returns false when the document does not match' , function ( done ) {
784
- var query = { x : 6 } ;
785
- if ( ! this . db . canPollDoc ( 'testcollection' , query ) ) return done ( ) ;
786
+ var dbQuery = getQuery ( { query : { x : 6 } } ) ;
787
+ if ( ! this . db . canPollDoc ( 'testcollection' , dbQuery ) ) return done ( ) ;
786
788
787
789
var snapshot = { type : 'json0' , v : 1 , data : { x : 5 , y : 6 } } ;
788
790
var db = this . db ;
789
791
db . commit ( 'testcollection' , 'test' , { v : 0 , create : { } } , snapshot , null , function ( err ) {
790
792
if ( err ) return done ( err ) ;
791
- db . queryPollDoc ( 'testcollection' , 'test' , query , null , function ( err , result ) {
793
+ db . queryPollDoc ( 'testcollection' , 'test' , dbQuery , null , function ( err , result ) {
792
794
if ( err ) return done ( err ) ;
793
795
expect ( result ) . equal ( false ) ;
794
796
done ( ) ;
0 commit comments