bruno icon indicating copy to clipboard operation
bruno copied to clipboard

feat: allow translation of more postman scripts

Open lanthoor opened this issue 1 year ago • 3 comments

Description

  1. 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") !== null
    • pm.expect( ... )expect( ... )
  2. Tests to cover the above scenarios
  3. Fixes for prettier issues in the changed files
  4. 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.

lanthoor avatar Mar 31 '24 06:03 lanthoor

@sanjai0py could you also approve the workflow run and assign reviewers for this PR, please?

lanthoor avatar Apr 02 '24 07:04 lanthoor

Why not !!bru.getEnvVar(...) instead of bru.getEnvVar("xyz") !== undefined && bru.getEnvVar("xyz") !== null ?

bpoulaindev avatar Apr 02 '24 12:04 bpoulaindev

Why not !!bru.getEnvVar(...) instead of bru.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.

lanthoor avatar Apr 03 '24 05:04 lanthoor