File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
src/plugins/expressions/common/execution Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,38 @@ describe('Execution', () => {
376376 value : 5 ,
377377 } ) ;
378378 } ) ;
379+
380+ test ( 'can use global variables' , async ( ) => {
381+ const result = await run (
382+ 'add val={var foo}' ,
383+ {
384+ variables : {
385+ foo : 3 ,
386+ } ,
387+ } ,
388+ null
389+ ) ;
390+
391+ expect ( result ) . toMatchObject ( {
392+ type : 'num' ,
393+ value : 3 ,
394+ } ) ;
395+ } ) ;
396+
397+ test ( 'can modify global variables' , async ( ) => {
398+ const result = await run (
399+ 'add val={var_set name=foo value=66 | var bar} | var foo' ,
400+ {
401+ variables : {
402+ foo : 3 ,
403+ bar : 25 ,
404+ } ,
405+ } ,
406+ null
407+ ) ;
408+
409+ expect ( result ) . toBe ( 66 ) ;
410+ } ) ;
379411 } ) ;
380412
381413 describe ( 'when arguments are missing' , ( ) => {
You can’t perform that action at this time.
0 commit comments