@@ -40,18 +40,19 @@ describe_only_db('mongo')('Parse.Query with comment testing', () => {
40
40
41
41
it ( 'send comment with query through REST' , async ( ) => {
42
42
const comment = 'Hello Parse' ;
43
+ const object = new TestObject ( ) ;
44
+ object . set ( 'name' , 'object' ) ;
45
+ await object . save ( ) ;
43
46
const options = Object . assign ( { } , masterKeyOptions , {
44
47
url : Parse . serverURL + '/classes/TestObject' ,
45
48
qs : {
46
49
explain : true ,
47
50
comment : comment ,
48
51
} ,
49
52
} ) ;
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 ) ;
55
56
} ) ;
56
57
57
58
it ( 'send comment with query' , async ( ) => {
@@ -88,12 +89,11 @@ describe_only_db('mongo')('Parse.Query with comment testing', () => {
88
89
object . set ( 'name' , 'object' ) ;
89
90
await object . save ( ) ;
90
91
const collection = await config . database . adapter . _adaptiveCollection ( 'TestObject' ) ;
91
- let result = await collection . aggregate ( [ { $group : { _id : '$name' } } ] , {
92
+ await collection . aggregate ( [ { $group : { _id : '$name' } } ] , {
92
93
explain : true ,
93
94
comment : comment ,
94
95
} ) ;
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 ) ;
98
98
} ) ;
99
99
} ) ;
0 commit comments