London | 26-ITP-May | Tomislav Dukez | Sprint 3 | Stretch#1454
Open
tomdu3 wants to merge 13 commits into
Open
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
reviewed
Jul 11, 2026
Comment on lines
+2
to
+5
| // Check if the card number is a positive integer. | ||
| if (typeof cardNumber !== "number" || cardNumber < 0) { | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
Note:
-
To check if a value is in integer,
Number.isInteger()is better. -
Credit card numbers typically have 16 digits, but not all 16-digit integers can be safely represented as a number in JS -- many numbers larger than
Number.MAX_SAFE_INTEGERcannot be represented properly. For example,9007199254740993. Normally, card numbers are represented as strings.
No change required.
Comment on lines
+54
to
+61
| test("password has at least one English lowercase letter (a-z)", () => { | ||
| // Arrange | ||
| const password = "1234Aa%"; | ||
| // Act | ||
| const result = isValidPassword(password); | ||
| // Assert | ||
| expect(result).toEqual(true); | ||
| }); |
Contributor
There was a problem hiding this comment.
Note:
-
One check for valid case is probably enough. Besides, having a lowercase letter (or digit, etc.) does not necessary make a password valid.
-
Your tests for invalid cases are comprehensive. Well done.
Contributor
|
Changes look good. Well done. |
Author
|
Thank you CJ for your time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Added tasks:
findpassword validatorcard validator