Skip to content

London | 26-ITP-SEPT | Carol Nassuna | Sprint 2 | Practice TDD - #1722

Open
Mugs3 wants to merge 1 commit into
CodeYourFuture:mainfrom
Mugs3:Sprint-2-pratcice-tdd
Open

Mugs3 wants to merge 1 commit into
CodeYourFuture:mainfrom
Mugs3:Sprint-2-pratcice-tdd

Conversation

@Mugs3

@Mugs3 Mugs3 commented Oct 16, 2026

Copy link
Copy Markdown
  • 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

Updated files in question

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

Thank you for your coursework. Keep it up.

Comment on lines 21 to +39
// Scenario: No Occurrences
// Given the input string `str`,
// And a character `char` that does not exist within `str`.
// When the function is called with these inputs,
// Then it should return 0, indicating that no occurrences of `char` were found.

test("should count multiple occurrences of a character", () => {
const str = "aaaaa";
const char = "z";
const count = countChar(str, char);
expect(count).toEqual(0);
});

test("should count multiple occurrences of a character", () => {
const str = "aaaaa";
const char = "7";
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.

These two test case are similar. However, there is a special str which also gives 0. Can you think of it? If so, please add it as well. Thank you.

Comment on lines +34 to +38
test("should append 'th' for numbers ending with 4, except those ending with 0", () => {
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(144)).toEqual("144th");
expect(getOrdinalNumber(40)).toEqual("40th");
});

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 should be more test cases related to lines 4-6 of your program. Please add them into this test suite. 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.

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 22, 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