Skip to content

London | 26-ITP-May | Anita Amirhaeri | Sprint 3 | implement-and-rewrite - #1568

Open
anitahy73 wants to merge 10 commits into
CodeYourFuture:mainfrom
anitahy73:coursework/sprint-3-implement-and-rewrite
Open

London | 26-ITP-May | Anita Amirhaeri | Sprint 3 | implement-and-rewrite#1568
anitahy73 wants to merge 10 commits into
CodeYourFuture:mainfrom
anitahy73:coursework/sprint-3-implement-and-rewrite

Conversation

@anitahy73

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

Sprint 3 Implement-and-rewrite

Implemented the getAngleType function to classify angles and added comprehensive test cases for different angle types, including acute, right, obtuse, reflex, zero, and complete angles, as well as invalid angles.
Implemented the isProperFraction function to check if a fraction is proper and added test cases for various scenarios.
Implement getCardValue function to validate and return card values. Add tests for valid and invalid card inputs.
Added Jest tests for card value function covering Aces, face cards, number cards, and invalid cards.
@anitahy73 anitahy73 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 Jul 26, 2026
Comment thread Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js Outdated
Comment thread Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js Outdated
Comment on lines +12 to +28
test(`should return true when denominator is higher than numerator`, () => {
expect(isProperFraction(0, 1)).toEqual(true);
expect(isProperFraction(2, 7)).toEqual(true);
expect(isProperFraction(89, 101)).toEqual(true);
});
// Special case: numerator or denominator is negative, we consider the absolute values for fractions so ignore the negative signs
test(`should return true when negative/positive numerator is less than the positive/negative denominator`, () => {
expect(isProperFraction(-20, -30)).toEqual(true);
expect(isProperFraction(-1, 2)).toEqual(true);
expect(isProperFraction(58, -68)).toEqual(true);
});
// Special case: numerator or denominator is negative, we consider the absolute values for fractions so ignore the negative signs
test(`should return false when negative/positive numerator is greater than the positive/negative denominator`, () => {
expect(isProperFraction(-50, 10)).toEqual(false);
expect(isProperFraction(100, 2)).toEqual(false);
expect(isProperFraction(-1, -0)).toEqual(false);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • You could use pseudo-code and notations like abs(...) and | ... | in the descriptions to more
    concisely describe the conditions.

  • What are other boundary cases you could also test?

expect(getCardValue("2♦")).toEqual(2);
});
//Case 4: Invalid cards
test(`Should return the invalid suit, invalid card or invalid card`, () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the function is expected to throw an error, we could indicate so in the test description as:

Should throw an error when ...

@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 Jul 27, 2026
@anitahy73 anitahy73 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 Aug 3, 2026
@cjyuan

cjyuan commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Changes look good.

@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 Aug 3, 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