@@ -24,31 +24,14 @@ const headers = {
2424} ;
2525
2626describe_only_db ( 'mongo' ) ( 'miscellaneous' , ( ) => {
27- it ( 'test rest_create_app' , function ( done ) {
28- let appId ;
29- Parse . _request ( 'POST' , 'rest_create_app' )
30- . then ( res => {
31- expect ( typeof res . application_id ) . toEqual ( 'string' ) ;
32- expect ( res . master_key ) . toEqual ( 'master' ) ;
33- appId = res . application_id ;
34- Parse . initialize ( appId , 'unused' ) ;
35- const obj = new Parse . Object ( 'TestObject' ) ;
36- obj . set ( 'foo' , 'bar' ) ;
37- return obj . save ( ) ;
38- } )
39- . then ( ( ) => {
40- const config = Config . get ( appId ) ;
41- return config . database . adapter . find ( 'TestObject' , { fields : { } } , { } , { } ) ;
42- } )
43- . then ( results => {
44- expect ( results . length ) . toEqual ( 1 ) ;
45- expect ( results [ 0 ] [ 'foo' ] ) . toEqual ( 'bar' ) ;
46- done ( ) ;
47- } )
48- . catch ( error => {
49- fail ( JSON . stringify ( error ) ) ;
50- done ( ) ;
51- } ) ;
27+ it ( 'db contains document after successful save' , async ( ) => {
28+ const obj = new Parse . Object ( 'TestObject' ) ;
29+ obj . set ( 'foo' , 'bar' ) ;
30+ await obj . save ( ) ;
31+ const config = Config . get ( defaultConfiguration . appId ) ;
32+ const results = await config . database . adapter . find ( 'TestObject' , { fields : { } } , { } , { } ) ;
33+ expect ( results . length ) . toEqual ( 1 ) ;
34+ expect ( results [ 0 ] [ 'foo' ] ) . toEqual ( 'bar' ) ;
5235 } ) ;
5336} ) ;
5437
0 commit comments