Skip to content

Conversation

@Alaa-Tagi
Copy link

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

I have created a PR with completed tasks as required.

Questions

No questions

@Alaa-Tagi Alaa-Tagi added 📅 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. Module-Structuring-And-Testing-Data The name of the module. labels Oct 12, 2025
@jennethydyrova jennethydyrova 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 23, 2025
Copy link

@jennethydyrova jennethydyrova left a comment

Choose a reason for hiding this comment

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

Hi @Alaa-Tagi! Great job on translating instructions into functions. It was quite easy to read your PR, which is always a good thing for a reviewer!

A couple of things to note:

  1. You should try to remove all your testing and scratch work when pushing a PR (mostly console logs in your case).
  2. Test cases need to be more comprehensive. Think of it this way: when you write different test cases for your functions, you help yourself catch bugs early. For example, currently your getOrdinalNumber function will most likely return "trueth" for num=true, which I don't think is the expected behavior.

Comment on lines 6 to 9
console.log(countChar('hello', 'l'));
console.log(countChar('hello', 'z'));
console.log(countChar('alaaaaa', 'a'));

Choose a reason for hiding this comment

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

Let's keep the PR clean and focused. Could you please remove all console logs from your PR?

// When the function is called with these inputs,
// Then it should return 0, indicating that no occurrences of the char were found in the case-sensitive str.

test("should return 0 for no occurrences", () => {

Choose a reason for hiding this comment

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

This test is good but it doesn't test different possible function inputs. What if the inputs' types are not strings, the char string is longer than the str string, or you have an empty string for either of the inputs, etc.? Testing different inputs will show whether your function accounts for different scenarios, which is what makes a function robust.

function getOrdinalNumber(num) {
return "1st";
num = num.toString();
if (num.slice(-2) === '11' || num.slice(-2) === '12' || num.slice(-2) === '13') {

Choose a reason for hiding this comment

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

Is there way not to repeat num.slice(-1) and num.slice(-2)?

test("should return '1st' for 1", () => {
expect(getOrdinalNumber(1)).toEqual("1st");
});

Choose a reason for hiding this comment

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

I like these test cases but again, what are other expected/unexpected inputs your function can receive and how will it behave? For example, what if num is undefined, a boolean, etc.? That's just two examples of num being not of a type you expect.

Comment on lines 2 to 3
const str = arguments[0];
const count = arguments[1];

Choose a reason for hiding this comment

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

Are you sure this is the right way of getting values of function arguments?

// When the repeat function is called with these inputs,
// Then it should return the original str without repetition, ensuring that a count of 1 results in no repetition.

test("should return the original string when count is 1", () => {

Choose a reason for hiding this comment

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

This test suit are more comprehensive but can you think of other test cases?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @jennethydyrova i have fixed all the errors that you have mentioned to me.

@jennethydyrova jennethydyrova 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 23, 2025
@Alaa-Tagi Alaa-Tagi 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 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants