Skip to content

Birmingham | ITP-Jan | Ahmad Roman Sanaye | Sprint 3 | Practice-tdd#1167

Open
RomanSanaye wants to merge 1 commit intoCodeYourFuture:mainfrom
RomanSanaye:coursework/sprint-3-practice-tdd
Open

Birmingham | ITP-Jan | Ahmad Roman Sanaye | Sprint 3 | Practice-tdd#1167
RomanSanaye wants to merge 1 commit intoCodeYourFuture:mainfrom
RomanSanaye:coursework/sprint-3-practice-tdd

Conversation

@RomanSanaye
Copy link

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

Implemented the following functions:

  • count
  • getOrdinalNumber
  • repeatStr

Each function handles the required cases and passes all Jest test cases, including edge cases (positive, zero, and negative values where applicable).

All tests are passing successfully.

@RomanSanaye RomanSanaye added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 4, 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.

I noticed some minor format inconsistency.

Have you installed the prettier VSCode extension and enabled "Format on save/paste" on VSCode, as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
?

If you have enabled "Format on save" but it is not working, it is likely that you haven't assign a formatter for JS file. This could happen if you have zero or multiple extensions that can format .js file.

If you have installed "Prettier" extension. To assign it as the formatter of JS code, you can try:

  1. Use "Format document" to format the JS file. Sometimes, VSCode will ask you to choose a formatter, and you can manually select "Prettier".
  2. Edit settings.json and set Prettier as the default formatter for JS.
    See: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

Comment on lines +11 to +13
if (numberOfChar === 0) {
return `0 ${findCharacter} found.`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The function is expected to return an integer number. Returning a string would make the function difficult to use because the caller would need to check the data type of the return value.

expect(getOrdinalNumber(33)).toEqual("33rd");
expect(getOrdinalNumber(333)).toEqual("333rd");
});
test("should append 'th' for numbers ending with 4 and more than 4", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

... ending with 4-9, 0 might be more concise.

// When the repeatStr function is called with these inputs,
// Then it should return the original `str` without repetition.

test("should print the original string", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

"print" may suggest the function should output the string.

// When the repeatStr function is called with these inputs,
// Then it should return an empty string.

test("should return an empty string", () => {
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 probably make this description more informative by including the when ... part.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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