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

test(number): replace RegExp with validation functions #1857

Merged
merged 7 commits into from Mar 23, 2023

Conversation

xDivisionByZerox
Copy link
Member

Description

This PR enhances the type validation in tests for the NumberModule.


Reasoning

[...] The tests will usually use regex or preferably validator.js to ensure the method returns valid results. [...]

This statement is from the projects CONTRIBUTING.md. The word of interest here is preferably. This is because RexExp can get out of hand really quickly and does not always result in easy-to-understand error messages since they only provide the RegExp and no information on where the error exactly happened.
This problem persist with Validation functions. But, they result in the error message providing the function's name which allows for a quicker evaluation of the actual problem if it is descriptive enough.

@xDivisionByZerox xDivisionByZerox added p: 1-normal Nothing urgent c: test m: number Something is referring to the number module labels Feb 19, 2023
@xDivisionByZerox xDivisionByZerox self-assigned this Feb 19, 2023
@xDivisionByZerox xDivisionByZerox requested a review from a team as a code owner February 19, 2023 13:03
@codecov
Copy link

codecov bot commented Feb 19, 2023

Codecov Report

Merging #1857 (5602219) into next (8076bb0) will decrease coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1857      +/-   ##
==========================================
- Coverage   99.63%   99.63%   -0.01%     
==========================================
  Files        2384     2384              
  Lines      238991   238991              
  Branches     1231     1231              
==========================================
- Hits       238125   238122       -3     
- Misses        844      847       +3     
  Partials       22       22              

see 2 files with indirect coverage changes

test/number.spec.ts Show resolved Hide resolved
test/number.spec.ts Show resolved Hide resolved
@ST-DDT ST-DDT requested review from Shinigami92 and a team March 20, 2023 20:12
@ST-DDT ST-DDT merged commit 26d8ac0 into next Mar 23, 2023
@ST-DDT ST-DDT deleted the test/number/decouple-type-check-from-implementation branch March 23, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: test m: number Something is referring to the number module p: 1-normal Nothing urgent
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants