Skip to content

Conversation

@Shayida999
Copy link

Sheffield | 25-ITP-Sep | Xiayidan Abuxuukuer | Sprint 3 | Coursework implement and rewrite

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

  • Completed the Sprint 3 stretch challenges in Sprint-3/3-stretch directory.
  • Implemented problem-solving exercises covering modular functions, loops, and array operations.
  • Added inline comments for clarity and maintainability.
  • Verified all solutions work correctly and pass any provided tests.

Questions

none for now thanks.

@Shayida999 Shayida999 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 15, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Can you also revert the change made in the Sprint-1 folder to keep this clean?

Comment on lines 10 to 21
function isProperFraction(numerator,denominator) {

if (numerator <denominator){

return true;
}

else {

return false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the definition of proper fraction in mathematics:

  • isProperFraction(-4, 3) should return false
  • isProperFraction(-2, 5) should return true
  • isProperFraction(-1, 1) should return false
  • isProperFraction(-2, -3) should return true

Can you look up the definition of proper fraction and update your function accordingly?

Comment on lines +5 to 8
test("should return 11 for Ace of Spades",() =>{
const aceofSpades = getCardValue("A♠");
expect(aceofSpades).toEqual(11);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a similar test for Ace on lines 31-37.

Copy link
Contributor

Choose a reason for hiding this comment

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

The tests on this script is pretty solid. Have you tried running this script (after you made changes to the implementation of the function in ../implement/3-get-card-value.js) to ensure the function can pass all tests?

Comment on lines 1 to 14
function countChar(stringOfCharacters, findCharacter){

let count =0;

for (let i = 0;i<stringOfCharacters.length;i++){

if (stringOfCharacters[i] ===findCharacter){

count =count +1;
}
}

return count;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Leaving a space around operators could make the code easier to read. You can consider using the "Format document" feature in VS Code to auto format the code. You may need to install the VSCode "prettier" extension first.

Comment on lines 26 to 40
test("count a's in aaaaa",()=>{
expect(countChar("aaaaa","a")).toEqual(5);
});

test("count z in hello",()=>{
expect(countChar("hello","z")).toEqual(0);
});

test("count b in abc",()=>{
expect(countChar("abc","b")).toEqual(1);
});

test("count a in empty string",()=>{
expect(countChar("","a")).toEqual(0);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Could consider including the tests on lines 31, 35 in the test category on lines 13-18. (It is better to group related tests into the same test category)

  • Test on line 27 is the same as the test on lines 14-17.

  • In Test-Driven Development, the test description should also describe the expected behavior of the function. Can you update the test description on line 38?

Comment on lines 14 to 25
test("should return '2nd' for 2",() =>{
expect(getOrdinalNumber(2)).toEqual("2nd");
});
test("should return '3rd' for 3",() =>{
expect(getOrdinalNumber(3)).toEqual("3rd");
});
test("should return '11th' for 11",() =>{
expect(getOrdinalNumber(11)).toEqual("11th");
});
test("should return '13th' for 13",() =>{
expect(getOrdinalNumber(13)).toEqual("13th");
});
Copy link
Contributor

Choose a reason for hiding this comment

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

To ensure thorough testing, we need broad scenarios that cover all possible cases.
Listing individual values, however, can quickly lead to an unmanageable number of test cases.
Instead of writing tests for individual numbers, consider grouping all possible input values into meaningful categories.
Then, select representative samples from each category to test. This approach improves coverage and makes our tests easier to maintain.

For example, we can prepare a test for numbers 2, 22, 132, etc. as

test("append 'nd' to numbers ending in 2, except those ending in 12", () => {
    expect( getOrdinalNumber(2) ).toEqual("2nd");
    expect( getOrdinalNumber(22) ).toEqual("22nd");
    expect( getOrdinalNumber(132) ).toEqual("132nd");
});

Can you update the tests in this script to make the tests more comprehensive. Ideally, the test categories could cover all valid numbers.

Copy link
Contributor

Choose a reason for hiding this comment

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

This script seems to be incomplete.
Since this is a stretch exercise, change is optional.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 19, 2025
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