Skip to content

London | 26-ITP-May | Mandip Sanger| Sprint 3| Practice Tdd - #1597

Open
mandipsanger wants to merge 15 commits into
CodeYourFuture:mainfrom
mandipsanger:practice-tdd
Open

London | 26-ITP-May | Mandip Sanger| Sprint 3| Practice Tdd#1597
mandipsanger wants to merge 15 commits into
CodeYourFuture:mainfrom
mandipsanger:practice-tdd

Conversation

@mandipsanger

@mandipsanger mandipsanger commented Aug 1, 2026

Copy link
Copy Markdown

Learners, PR Template

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

PR sprint 3 tdd

@github-actions

This comment has been minimized.

@mandipsanger mandipsanger changed the title London | 25-ITP-May | Mandip Sanger| Sprint 1 | Practice Tdd London | 25-ITP-May | Mandip Sanger| Sprint 3 | Practice Tdd Aug 1, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@mandipsanger mandipsanger changed the title London | 25-ITP-May | Mandip Sanger| Sprint 3 | Practice Tdd London | 25-ITP-May | Mandip Sanger| Sprint 3| Practice Tdd Aug 1, 2026
@github-actions

This comment has been minimized.

@mandipsanger mandipsanger changed the title London | 25-ITP-May | Mandip Sanger| Sprint 3| Practice Tdd London | 26-ITP-May | Mandip Sanger| Sprint 3| Practice Tdd Aug 1, 2026
@github-actions

This comment has been minimized.

@mandipsanger mandipsanger added 🏕 Priority Mandatory This work is expected 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 6, 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 Aug 7, 2026
Comment on lines +43 to +50
test("should return 0 when the character does not occur in the string", () => {
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.

duplicated test case

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 for multiple occurrences because the example just tested the case of character in the whole string.

expect(getOrdinalNumber(13)).toEqual("13th");
});
test('should append "nd" when the number ends with 2', () => {
expect(getOrdinalNumber(22)).toEqual("22nd");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

By referencing to the given example, please add more unique test cases within this test set.

expect(getOrdinalNumber(22)).toEqual("22nd");
});
test('should append "rd" when the number ends with 3', () => {
expect(getOrdinalNumber(23)).toEqual("23rd");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

By referencing to the given example, please add more unique test cases within this test set.

Comment on lines +23 to +33
// Case 2: Numbers ending with 11
test('should append "th" when the number ends with 11', () => {
expect(getOrdinalNumber(11)).toEqual("11th");
});
// Then the function should return a string by appending "st" to the number.
test('should append "th" when the number ends with 12', () => {
expect(getOrdinalNumber(12)).toEqual("12th");
});
test('should append "th" when the number is 13', () => {
expect(getOrdinalNumber(13)).toEqual("13th");
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's good that you tested the special cases of 11, 12, and 13. It would be nice if larger values (like 511th or 413th) are tested as well.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How about empty string (with the same set of counts 3, 1, 0, -1)?

@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.

Generally good and in the right direction. Just the test cases can cover more unique scenarios. Keep it up :-)

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

Labels

🏕 Priority Mandatory This work is expected Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants