Skip to content

Birmingham | 26-ITP-Jan | Tasleem Adedokun | Sprint 3 | Coursework 3 implement and rewrite#1170

Open
tasleemadedokun wants to merge 12 commits intoCodeYourFuture:mainfrom
tasleemadedokun:coursework/sprint-3-implement-and-rewrite
Open

Birmingham | 26-ITP-Jan | Tasleem Adedokun | Sprint 3 | Coursework 3 implement and rewrite#1170
tasleemadedokun wants to merge 12 commits intoCodeYourFuture:mainfrom
tasleemadedokun:coursework/sprint-3-implement-and-rewrite

Conversation

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

Brief;
I have done all the coursework to the best of my ability, and I made several commits to effect changes.

@tasleemadedokun tasleemadedokun 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 Mar 4, 2026
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.

  • Functions are correct

  • Tests are also quite comprehensive

  • Some test descriptions could be made clearer

Comment on lines +29 to +32
test("Should throw an error for invalid cards", () => {
expect(() => getCardValue(null)).toThrow();
expect(() => getCardValue(undefined)).toThrow();
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not test also strings that are not in the expected format?

Copy link
Author

Choose a reason for hiding this comment

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

Why not test also strings that are not in the expected format?

I have now tested for strings.

@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 Mar 14, 2026
Comment on lines +14 to +31
test(`should return true for positive proper fractions (numerator < denominator)`, () => {
expect(isProperFraction(1, 2)).toEqual(true);
expect(isProperFraction(2, 4)).toEqual(true);
})

// Case 3: negative proper fractions
test(`should return true for negative proper fractions (numerator < denominator)`, () => {
expect(isProperFraction(-1, -2)).toEqual(true);
expect(isProperFraction(-2, -4)).toEqual(true);
})

// Case 4: improper fractions (numerator >= denominator)
test(`should return false for improper fractions`, () => {
expect(isProperFraction(4, 2)).toEqual(false);
expect(isProperFraction(4, 4)).toEqual(false);
expect(isProperFraction(-6, 4)).toEqual(false);
expect(isProperFraction(7, -2)).toEqual(false);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use pseudo-code and notations like abs(...) or | ... | in the descriptions to more concisely describe the conditions (the "when" part).

Copy link
Author

Choose a reason for hiding this comment

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

We can use pseudo-code and notations like abs(...) or | ... | in the descriptions to more concisely describe the conditions (the "when" part).

I have done that.

Copy link
Author

Choose a reason for hiding this comment

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

@cjyuan Thank you very much always. I always appreciate your reviews, and I have implemented all the changes. Thank you very much.

@tasleemadedokun tasleemadedokun 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 Mar 15, 2026
@tasleemadedokun tasleemadedokun requested a review from cjyuan March 15, 2026 13:23
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.

Changes look good. I will mark this PR as complete first.

// Invalid Cards
test("Should throw an error for invalid cards", () => {
expect(() => getCardValue(null)).toThrow();
expect(() => getCardValue(undefined)).toThrow();
Copy link
Contributor

Choose a reason for hiding this comment

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

Your code didn't actually checked if the value of card is string or not.

Your function would throw a TypeError (kind of an unexpected error) instead of the controlled "Invalid card" error.

Including these tests in the test script may send the wrong message that the function should properly check the type of the argument and classify any value that is not a string as "Invalid card".

Comment on lines +30 to +31
expect(() => getCardValue("11")).toThrow();
expect(() => getCardValue("happy")).toThrow();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also consider testing these cases:

  • Valid rank + invalid suit character
  • Valid rank + no suit
  • Empty string
  • Valid suit + invalid rank

@cjyuan cjyuan 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 Mar 15, 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. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants