Skip to content

Manchester | 26-ITP-Sept | Rahana Suleiman | Sprint 2 | Practice TDD - #1691

Open
rahanasuleiman8-ship-it wants to merge 8 commits into
CodeYourFuture:mainfrom
rahanasuleiman8-ship-it:coursework/sprint-3-practice-tdd
Open

rahanasuleiman8-ship-it wants to merge 8 commits into
CodeYourFuture:mainfrom
rahanasuleiman8-ship-it:coursework/sprint-3-practice-tdd

Conversation

@rahanasuleiman8-ship-it

Copy link
Copy Markdown

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

Task code

CYF-1060

Changelist

This PR completes the TDD exercises for countChar, getOrdinalNumber, and a custom repeatStr implementation, fully covered by passing unit test suites verified via npm run test

@github-actions

This comment has been minimized.

@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2026
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2026
@rahanasuleiman8-ship-it
rahanasuleiman8-ship-it force-pushed the coursework/sprint-3-practice-tdd branch from b39816b to a1f5c71 Compare October 12, 2026 23:53
@rahanasuleiman8-ship-it rahanasuleiman8-ship-it added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2026
@hackertainment hackertainment added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 18, 2026

@hackertainment hackertainment left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code generally looks ok to me. Keep it up.

Comment on lines 12 to 17
test("should count multiple occurrences of a character", () => {
const str = "aaaaa";
const char = "a";
const count = countChar(str, char);
expect(count).toEqual(5);
});

@hackertainment hackertainment Oct 19, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a special case of str where it is all the char to count. Would it still count correctly if the char just exists in some part of the str?

Comment on lines +24 to +29
test("should return 0 when the character is not found in the string", () => {
const str = "hello";
const char = "z";
const count = countChar(str, char);
expect(count).toEqual(0);
});

@hackertainment hackertainment Oct 19, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is a special str that would give 0 anyway. Please add that test case as well. Thank you.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good coverage of test cases.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your test cases are correct. Just for you to think a little bit more, besides const str = "hello", what special string should also be added to each of the test cases?

@hackertainment hackertainment added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Oct 19, 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