Skip to content

test: add unit tests for utility functions#470

Open
vaibhavchopra-wq wants to merge 5 commits into
masterfrom
chore/add-unit-tests
Open

test: add unit tests for utility functions#470
vaibhavchopra-wq wants to merge 5 commits into
masterfrom
chore/add-unit-tests

Conversation

@vaibhavchopra-wq
Copy link
Copy Markdown

  • Add tests for isNonNullObject (plain objects, null, arrays, primitives)
  • Add tests for isValidUrl (https, http, invalid URLs, non-string inputs)
  • Add tests for generateOnboardingSignature (hex output, different inputs, empty params)
  • Add edge case tests for validateWebhookSignature:
    • undefined params, Buffer body, wrong length
    • non-hex signature, empty signature, tampered valid-hex signature
  • Add error handling tests for validatePaymentVerification (missing secret, missing order_id)

Coverage improvement:

  • razorpay-utils.js: 64% → 96.87%
  • Overall: 73.47% → 75.07%
  • Tests: 379 → 400 (+21)

Note :- Please follow the below points while attaching test cases document link below:

- If label Tested is added then test cases document URL is mandatory.

- Link added should be a valid URL and accessible throughout the org.

- If the branch name contains hotfix / revert by default the BVT workflow check will pass.

Test Case Document URL
Please paste test case document link here....

- Add tests for isNonNullObject (plain objects, null, arrays, primitives)
- Add tests for isValidUrl (https, http, invalid URLs, non-string inputs)
- Add tests for generateOnboardingSignature (hex output, different inputs, empty params)
- Add edge case tests for validateWebhookSignature:
  - undefined params, Buffer body, wrong length
  - non-hex signature, empty signature, tampered valid-hex signature
- Add error handling tests for validatePaymentVerification (missing secret, missing order_id)

Coverage improvement:
- razorpay-utils.js: 64% → 96.87%
- Overall: 73.47% → 75.07%
- Tests: 379 → 400 (+21)
@vaibhavchopra-wq vaibhavchopra-wq added the TestingNotRequired TestingNotRequired label for BVT label Apr 29, 2026
@vaibhavchopra-wq vaibhavchopra-wq marked this pull request as ready for review April 29, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TestingNotRequired TestingNotRequired label for BVT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant