Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(isUpiId): Added regex and tests for UPI id validation #2318

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Swarga-codes
Copy link

Added validation for a given UPI id so that people can validate the UPI addresses before performing any transaction as per issue #2317 .

Read more about UPI(Unified Payments Interface): https://en.wikipedia.org/wiki/Unified_Payments_Interface

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't thought about the usefulness of this validator yet, but do have an initial comment

@@ -14463,54 +14463,32 @@ describe('Validators', () => {
],
});
});
it('should validate mailto URI', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove existing tests

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied the existing test for the format and modified it according to my function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WikiRik can you check I modified the code and fixed the bugs!

@codecov
Copy link

codecov bot commented Oct 7, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b958bd7) 99.95% compared to head (3942950) 98.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2318      +/-   ##
==========================================
- Coverage   99.95%   98.57%   -1.39%     
==========================================
  Files         107      108       +1     
  Lines        2454     2457       +3     
  Branches      619      620       +1     
==========================================
- Hits         2453     2422      -31     
- Misses          0       35      +35     
+ Partials        1        0       -1     
Files Coverage Δ
src/index.js 100.00% <100.00%> (ø)
src/lib/isUpiId.js 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Swarga-codes
Copy link
Author

Haven't thought about the usefulness of this validator yet, but do have an initial comment

Users can use this in those scenarios where they are storing some UPI id in their database which is quite crucial and a well defined format or a check should be there so that they cannot fill any type of data they wish to store rather a proper formatted data would be stored in database. Also in certain scenarios it might catch the typos made by the users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants