Skip to content

Sheffield | 26-ITP-Jan | Seti Mussa | Sprint 3 | Coursework pratice tdd#1283

Open
Seti-Jemal wants to merge 6 commits intoCodeYourFuture:mainfrom
Seti-Jemal:coursework-sprint-3-pratice-tdd
Open

Sheffield | 26-ITP-Jan | Seti Mussa | Sprint 3 | Coursework pratice tdd#1283
Seti-Jemal wants to merge 6 commits intoCodeYourFuture:mainfrom
Seti-Jemal:coursework-sprint-3-pratice-tdd

Conversation

@Seti-Jemal
Copy link
Copy Markdown

@Seti-Jemal Seti-Jemal commented Mar 30, 2026

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

Write a function that counts how many times a given character appears in a string, and passes all Jest tests.

Questions

N/A

@github-actions

This comment has been minimized.

@Seti-Jemal Seti-Jemal added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 30, 2026
Comment on lines 36 to 48
// Case 4: Number ending with 4 (but not 14)
test("should append 'th' for number ending with 4 expcet those ending with 14", () => {
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(44)).toEqual("44th");
expect(getOrdinalNumber(54)).toEqual("54th");
});

// Case 5: Number ending with 5 (but not 15)
test("should append 'th' for number ending with 5 except those ending with 15", () => {
expect(getOrdinalNumber(5)).toEqual("5th");
expect(getOrdinalNumber(55)).toEqual("55th");
expect(getOrdinalNumber(65)).toEqual("65th");
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What are so special about 14 and 15?

These two test categories do not yet cover all possible numbers not included in the previous test cases. You can consider just creating one test category for all the numbers that should be appended with "th".
However, you should avoid describing these numbers as "all other numbers" because
when a test fails with such a message, it may be unclear what "other numbers" actually refers to.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi CJ,
Thank you for the feedback. I have updated the test, removed 14 and 15, and added the special case as required.

Comment on lines 1 to 3
function repeatStr(n, str) {
return str.repeat(n);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this function pass the tests in repeat-str.test.js?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have fixed it now.

@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 30, 2026
@Seti-Jemal Seti-Jemal added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 31, 2026
@Seti-Jemal Seti-Jemal removed the Reviewed Volunteer to add when completing a review with trainee action still to take. label Mar 31, 2026
Copy link
Copy Markdown
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.

});

// Case 5: Numbers ending with 0, 4, 5, 6, 7, 8, or 9 (but not those ending with 11, 12, or 13)
test("should append 'th' for number ending with 0, 4, 5, 6, 7, 8, or 9 ,(but not those ending with 11, 12, or 13)", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Part the the condition specified in this description does not carry new information, and therefore can be dropped.

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