File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,16 @@ describe('Cloud Code', () => {
5050 } ) ;
5151 } ) ;
5252
53+ it ( 'can get config' , ( ) => {
54+ const config = Parse . Server ;
55+ let currentConfig = Config . get ( 'test' ) ;
56+ expect ( Object . keys ( config ) ) . toEqual ( Object . keys ( currentConfig ) ) ;
57+ config . silent = false ;
58+ Parse . Server = config ;
59+ currentConfig = Config . get ( 'test' ) ;
60+ expect ( currentConfig . silent ) . toBeFalse ( ) ;
61+ } ) ;
62+
5363 it ( 'show warning on duplicate cloud functions' , done => {
5464 const logger = require ( '../lib/logger' ) . logger ;
5565 spyOn ( logger , 'warn' ) . and . callFake ( ( ) => { } ) ;
Original file line number Diff line number Diff line change @@ -374,6 +374,16 @@ class ParseServer {
374374
375375function addParseCloud ( ) {
376376 const ParseCloud = require ( './cloud-code/Parse.Cloud' ) ;
377+ Object . defineProperty ( Parse , 'Server' , {
378+ get ( ) {
379+ return Config . get ( Parse . applicationId ) ;
380+ } ,
381+ set ( newVal ) {
382+ newVal . appId = Parse . applicationId ;
383+ Config . put ( newVal ) ;
384+ } ,
385+ configurable : true ,
386+ } ) ;
377387 Object . assign ( Parse . Cloud , ParseCloud ) ;
378388 global . Parse = Parse ;
379389}
You can’t perform that action at this time.
0 commit comments