Skip to content

Sheffield | 26-ITP-Jan | Mahmoud Shaabo | Sprint 3 | Practice TDD#1214

Open
mahmoudshaabo1984 wants to merge 2 commits intoCodeYourFuture:mainfrom
mahmoudshaabo1984:coursework/sprint-3-practice-tdd
Open

Sheffield | 26-ITP-Jan | Mahmoud Shaabo | Sprint 3 | Practice TDD#1214
mahmoudshaabo1984 wants to merge 2 commits intoCodeYourFuture:mainfrom
mahmoudshaabo1984:coursework/sprint-3-practice-tdd

Conversation

@mahmoudshaabo1984
Copy link

[x] I have tested my changes

[x] My changes follow the style guide

[x] I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title

[x] My changes meet the requirements of the task

PR Title:

Sheffield | 26-ITP-Jan | Mahmoud Shaabo | Sprint 3 | Practice TDD

Summary of work:

Completed all mandatory TDD exercises in the 2-practice-tdd directory.

Successfully implemented logic for the following using TDD (Red-Green-Refactor):

count.js: Created a function to count occurrences of a character in a string.

repeat-str.js: Implemented string repetition with a guard clause for negative numbers and the .repeat() method.

get-ordinal-number.js: Solved the complex logic for English ordinal numbers, including specific handling for 11th, 12th, and 13th.

Verified that all 5 tests passed successfully using npm test.

Personal Note for CJ:

Hi CJ,
Following your previous feedback, I have ensured that all checkboxes now use the correct - [x] syntax.
This "Practice TDD" assignment was a significant milestone for me. Navigating the test failures with NVDA and then writing the logic to make them pass helped me deeply understand the TDD cycle. I'm especially pleased with how I handled the edge cases for the ordinal numbers!

Best regards,
Mahmoud Shaabo

@mahmoudshaabo1984 mahmoudshaabo1984 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.

  • Code looks good. I just have some suggestions for some of the test descriptions.

  • You missed updating count.test.js.

Comment on lines +27 to +31
test("should append 'th' for 11, 12, and 13", () => {
expect(getOrdinalNumber(11)).toEqual("11th");
expect(getOrdinalNumber(12)).toEqual("12th");
expect(getOrdinalNumber(13)).toEqual("13th");
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Could better update the description and include tests to cover "numbers ending with 11, 12, 13" and not just the three numbers, 11, 12, 13.

Comment on lines 34 to 37
test("should append 'th' for other numbers", () => {
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(10)).toEqual("10th");
});
Copy link
Contributor

Choose a reason for hiding this comment

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

When a test fails with the message "... other numbers", it may be unclear what "other numbers" actually refers to.
Can you revise the test description to make it more informative?

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

cjyuan commented Mar 12, 2026

In the PR description, the checkboxes are currently marked as [x] (without a dash and a space character before [x]).

@mahmoudshaabo1984
Copy link
Author

Hi CJ,

Thank you for the detailed review and for pointing those out! I appreciate the feedback.

I have just pushed the updates:

  1. I updated count.test.js which I missed earlier.
  2. I updated the test description for the 11, 12, 13 edge cases to be more accurate ("numbers ending with 11, 12, 13") and added new expect statements for larger numbers like 111 and 212 to prove the logic covers them.
  3. I changed the vague "other numbers" description to explicitly state the numbers being tested (ending in 0, 4, 5, 6, 7, 8, 9) for better readability.

Could you please take another look when you have a moment?

Thanks again!
Mahmoud

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. Well done.

Note: In the PR description, the checkboxes are currently only marked as [x] in Markdown instead of as - [x].
- [x] is the proper syntax in Markdown for checked checkbox.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 12, 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