Skip to content

Sheffield | 26-ITP-jan | Richard Frimpong | Sprint 3 | Stretch Coursework#1250

Open
Richiealx wants to merge 2 commits intoCodeYourFuture:mainfrom
Richiealx:coursework/sprint-3-stretch-redo
Open

Sheffield | 26-ITP-jan | Richard Frimpong | Sprint 3 | Stretch Coursework#1250
Richiealx wants to merge 2 commits intoCodeYourFuture:mainfrom
Richiealx:coursework/sprint-3-stretch-redo

Conversation

@Richiealx
Copy link

@Richiealx Richiealx commented Mar 12, 2026

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Completed the Sprint 3 stretch tasks.

Password Validator

  • Implemented password validation rules in password-validator.js
  • Added Jest tests in password-validator.test.js

Credit Card Validator

  • Implemented credit card validation logic in card-validator.js
  • Added Jest tests in card-validator.test.js

Testing

All tests were run using:

All tests passed successfully.

@Richiealx Richiealx added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 12, 2026
return password.length < 5 ? false : true
}
// Password must be at least 5 characters long.
if (password.length < 5) {
Copy link

Choose a reason for hiding this comment

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

Could password just not be provided at all?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @ykamal,

Good point, thank you.

I updated the function to handle the case where a password is not provided.
Previously the function accessed password.length, which would throw an error if the value was undefined.

I added an input validation check at the start of the function to ensure the password exists and is a string. If it is missing or not a string, the function now safely returns false.

I also added test cases to cover these scenarios.

@ykamal ykamal added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 12, 2026
@Richiealx Richiealx added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants