London | 26-ITP-May | Tomislav Dukez | Sprint 3 | Stretch - #1454
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // Check if the card number is a positive integer. | ||
| if (typeof cardNumber !== "number" || cardNumber < 0) { | ||
| return false; | ||
| } |
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.
| 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); | ||
| }); |
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.
|
Changes look good. Well done. |
|
Thank you CJ for your time. |
|
Closing PR because the May ITP run has finished. Feel free to re-open if you're still working on it. |
Learners, PR Template
Self checklist
Changelist
Added tasks:
findpassword validatorcard validator