feat: allow translation of more postman scripts
Description
- This PR allows translation of additional Postman specific scripts.
pm.response.json()→res.getBody()pm.environment.has("xyz")→bru.getEnvVar("xyz") !== undefined && bru.getEnvVar("xyz") !== nullpm.expect( ... )→expect( ... )
- Tests to cover the above scenarios
- Fixes for
prettierissues in the changed files - Fix an incorrect regex in the translation script
'pm.response.to.have\\.status\\('→'pm\\.response\\.to\\.have\\.status\\('
Fixes #1973
Contribution Checklist:
- [x] The pull request only addresses one issue or adds one feature.
- [x] The pull request does not introduce any breaking changes
- [x] I have added screenshots or gifs to help explain the change if applicable.
- [x] I have read the contribution guidelines.
- [x] Create an issue and link to the pull request.
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
@sanjai0py could you also approve the workflow run and assign reviewers for this PR, please?
Why not !!bru.getEnvVar(...) instead of bru.getEnvVar("xyz") !== undefined && bru.getEnvVar("xyz") !== null ?
Why not
!!bru.getEnvVar(...)instead ofbru.getEnvVar("xyz") !== undefined && bru.getEnvVar("xyz") !== null?
@bpoulaindev pm.environment.has() does not check for non-empty/truthy value. It only checks for the presence of the key. If I do !!bru.getEnvVar(), it will return true only if the value is non-empty/truthy.