Skip to content

Sheffield | 26-ITP-Jan | Mahammad Osman | Sprint 3 | Practice TDD#1262

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

Sheffield | 26-ITP-Jan | Mahammad Osman | Sprint 3 | Practice TDD#1262
Darkidd77 wants to merge 3 commits intoCodeYourFuture:mainfrom
Darkidd77:coursework/sprint-3-practice-tdd

Conversation

@Darkidd77
Copy link

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

I used a professional approach called TDD (Test-Driven Development), which means I wrote my tests before writing any code. I built three main tools: a character counter, a string repeater, and an ordinal number generator (like turning "1" into "1st").

@Darkidd77 Darkidd77 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 13, 2026
// When the function is called with these inputs,
// Then it should return 0, indicating that no occurrences of `char` were found.

test("should show no occurrences of a character", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably clearer to state what the function "should return ... when ..." than the current description.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, Noted, I edited it, I see it's clearer message now. Thank you

Comment on lines +2 to +5
// 1. Handle the 11, 12, 13 exceptions first
if (num === 11 || num === 12 || num === 13) {
return num + "th";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The rule apply to all numbers ending with 11, 12, and 13 (not just to those three numbers).

Copy link
Author

Choose a reason for hiding this comment

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

Updated the code to solve all number that ends with 11, 12, or 13. Thank you

// Case 5: Numbers ending with 0, 4, 5, 6, 7, 8, or 9 (but not 10)
// When the number ends with 0, 4, 5, 6, 7, 8, or 9, except those ending with 10,
// Then the function should return a string by appending "th" to the number.
test("should append 'th' for numbers ending with 0, 4-9, except those ending with 10", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This description is giving mixed info. Should 110 be converted to 110th or not?

Copy link
Author

Choose a reason for hiding this comment

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

Yes I realised I treated 10 as an exception but it's not and part of the rule, I've updated the test message and added a case.

@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 13, 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.

You should also add the "Needs Review" label.

Comment on lines +50 to +53
// Case 5: Numbers ending with 0, 4, 5, 6, 7, 8, or 9 (but not 10)
// When the number ends with 0, 4, 5, 6, 7, 8, or 9, except those ending with 10,
// Then the function should return a string by appending "th" to the number.
test("should return 'th' for numbers ending in 0 or 4 through 9", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The comments on line 50-53 still showing contradicting info.
Do you still need all these comments now that you have rephrase them, in a concise way, in the test description?

@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 14, 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