@@ -40,18 +40,19 @@ describe_only_db('mongo')('Parse.Query with comment testing', () => {
4040
4141 it ( 'send comment with query through REST' , async ( ) => {
4242 const comment = 'Hello Parse' ;
43+ const object = new TestObject ( ) ;
44+ object . set ( 'name' , 'object' ) ;
45+ await object . save ( ) ;
4346 const options = Object . assign ( { } , masterKeyOptions , {
4447 url : Parse . serverURL + '/classes/TestObject' ,
4548 qs : {
4649 explain : true ,
4750 comment : comment ,
4851 } ,
4952 } ) ;
50- const response = await request ( options ) ;
51- let result = response . data . results ;
52- expect ( result . command . comment ) . toBe ( comment ) ;
53- result = await database . collection ( 'system.profile' ) . findOne ( { } , { sort : { ts : - 1 } } ) ;
54- expect ( result . command . comment ) . toBe ( comment ) ;
53+ await request ( options ) ;
54+ const result = await database . collection ( 'system.profile' ) . findOne ( { } , { sort : { ts : - 1 } } ) ;
55+ expect ( result . command . explain . comment ) . toBe ( comment ) ;
5556 } ) ;
5657
5758 it ( 'send comment with query' , async ( ) => {
@@ -88,12 +89,11 @@ describe_only_db('mongo')('Parse.Query with comment testing', () => {
8889 object . set ( 'name' , 'object' ) ;
8990 await object . save ( ) ;
9091 const collection = await config . database . adapter . _adaptiveCollection ( 'TestObject' ) ;
91- let result = await collection . aggregate ( [ { $group : { _id : '$name' } } ] , {
92+ await collection . aggregate ( [ { $group : { _id : '$name' } } ] , {
9293 explain : true ,
9394 comment : comment ,
9495 } ) ;
95- expect ( result [ 0 ] . command . comment ) . toBe ( comment ) ;
96- result = await database . collection ( 'system.profile' ) . findOne ( { } , { sort : { ts : - 1 } } ) ;
97- expect ( result . command . comment ) . toBe ( comment ) ;
96+ const result = await database . collection ( 'system.profile' ) . findOne ( { } , { sort : { ts : - 1 } } ) ;
97+ expect ( result . command . explain . comment ) . toBe ( comment ) ;
9898 } ) ;
9999} ) ;
0 commit comments