Skip to content

North West | 26-ITP-Sep | Brian Yorachi | Sprint 2 | practice TDD - #1706

Open
BrianY315 wants to merge 4 commits into
CodeYourFuture:mainfrom
BrianY315:coursework/sprint-3-practice-tdd
Open

BrianY315 wants to merge 4 commits into
CodeYourFuture:mainfrom
BrianY315:coursework/sprint-3-practice-tdd

Conversation

@BrianY315

@BrianY315 BrianY315 commented Oct 14, 2026 •

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

Completed TDD exercises using Jest. Implemented the required functions and wrote tests to cover the expected behaviour and edge cases

@github-actions

This comment has been minimized.

@BrianY315 BrianY315 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 14, 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 good to me. Please keep it up.

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

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?

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.

“Thanks for the suggestion! I added a test that counts 'l' in 'hello' and expects 2.”

Comment on lines +26 to +31
test("should return 0 when the character does not occur", () => {
const str = "hello";
const char = "z";
const count = countChar(str, char);
expect(count).toEqual(0);
});

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
Author

Choose a reason for hiding this comment

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

“Thanks! I added a test using an empty string as the input; it correctly returns 0.”

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?

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.

“Thanks for pointing that out! I added empty-string checks to each repeatStr test case.”

@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
@BrianY315
BrianY315 force-pushed the coursework/sprint-3-practice-tdd branch from ffb9851 to 8a70a6d Compare October 19, 2026 16:59
@BrianY315 BrianY315 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 19, 2026
@hackertainment

Copy link
Copy Markdown

Wee done to all the additional test cases. Congratulation, you have completed this PR successfully.

@hackertainment hackertainment 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 Oct 20, 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