pactumjs / pactum

REST API Testing Tool for all levels in a Test Pyramid
https://pactumjs.github.io
MIT License
545 stars 52 forks source link

Modified data processor functional param splitting logic #307

Closed mshangle1 closed 10 months ago

mshangle1 commented 10 months ago

Reference issue: #305

When providing parameters to function mapping (ie: $F{sum:1,2}), if the parameter includes a : character, the rest of the parameter is cut off from being included in the arguments.

In dataProcessor.js line 104, the FunctionName:param1,param2 string is being split up by the : character for all instances of the character, causing arguments which include a : to be split and not passed to the function when it is filtered out on line 106.

I modified the behavior by changing the refValue.split(':') on line 104 to use a regex expression to only split by the first instance of the : character like so refValue.split(/:(.*)/) so params including the ':' character can be passed to functions