Skip to content

London | ITP-JAN-2026 | Said Fayaz Sadat | Sprint 3 | coursework/sprint-3/practise-tdd#1222

Open
fayaz551 wants to merge 7 commits intoCodeYourFuture:mainfrom
fayaz551:coursework/Sprint-3-practice-tdd
Open

London | ITP-JAN-2026 | Said Fayaz Sadat | Sprint 3 | coursework/sprint-3/practise-tdd#1222
fayaz551 wants to merge 7 commits intoCodeYourFuture:mainfrom
fayaz551:coursework/Sprint-3-practice-tdd

Conversation

@fayaz551
Copy link

@fayaz551 fayaz551 commented Mar 7, 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

This PR covers the Sprint 3 Practice TDD coursework. I have separated this into its own branch to meet the sprint requirements and ensure the GitHub validation bot passes.

Questions

n/a

@fayaz551
Copy link
Author

fayaz551 commented Mar 7, 2026

@cjyuan created PR for practice-tdd

@fayaz551 fayaz551 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 7, 2026
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

This exercise also expects the three functions to be implemented after you have prepared the tests.

Comment on lines +47 to +48
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(5)).toEqual("5th");
Copy link
Contributor

Choose a reason for hiding this comment

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

Could consider testing more samples, ideally covering all digits that should be appended with "th".

Copy link
Author

Choose a reason for hiding this comment

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

Added the full implementation of getOrdinalNumber.
The function now correctly handles all cases:
Tests for All other numbers append "th".

Copy link
Contributor

Choose a reason for hiding this comment

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

You could also describe the numbers in this category as "numbers not ending with 1, 2 and 3" or "numbers ending with 0, 4-9".

Copy link
Author

Choose a reason for hiding this comment

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

I will change the description for it

@cjyuan cjyuan 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 8, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Mar 8, 2026

Can you also revise the description in the Changelist section of the PR description?

@fayaz551 fayaz551 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 8, 2026
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes look good.

Comment on lines +6 to +17
if (count === 0) {
return "";
}

if (count === 1) {
return str;
}

let result = "";
for (let i = 0; i < count; i++) {
result += str;
}
Copy link
Contributor

@cjyuan cjyuan Mar 8, 2026

Choose a reason for hiding this comment

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

This code works.

Note: There is also a string's built-in method we can use to simplify this code.

No change is needed.

Comment on lines +47 to +48
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(5)).toEqual("5th");
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also describe the numbers in this category as "numbers not ending with 1, 2 and 3" or "numbers ending with 0, 4-9".

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants