File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -635,6 +635,19 @@ describe('Hooks', () => {
635635 done ( ) ;
636636 } ) ;
637637 } ) ;
638+
639+ it ( 'should log warning when webhook overwrites existing Cloud Code function' , async ( ) => {
640+ const logger = require ( '../lib/logger' ) . logger ;
641+ spyOn ( logger , 'warn' ) . and . callFake ( ( ) => { } ) ;
642+ Parse . Cloud . define ( 'myCloudFunction' , ( ) => 'cloud result' , { requireMaster : true } ) ;
643+ expect ( triggers . getFunction ( 'myCloudFunction' , Parse . applicationId ) ) . toBeDefined ( ) ;
644+ expect ( triggers . getValidator ( 'myCloudFunction' , Parse . applicationId ) ) . toBeDefined ( ) ;
645+ await Parse . Hooks . createFunction ( 'myCloudFunction' , hookServerURL + '/hook' ) ;
646+ expect ( logger . warn ) . toHaveBeenCalledWith (
647+ 'Warning: Duplicate cloud functions exist for myCloudFunction. Only the last one will be used and the others will be ignored.'
648+ ) ;
649+ await Parse . Hooks . removeFunction ( 'myCloudFunction' ) ;
650+ } ) ;
638651} ) ;
639652
640653describe ( 'triggers' , ( ) => {
You can’t perform that action at this time.
0 commit comments