Skip to content

London | 26-ITP-Sep |Shirin Panahian | Sprint 2 | Implement and rewrite tests - #1699

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

shirinpanahian wants to merge 19 commits into
CodeYourFuture:mainfrom
shirinpanahian:coursework/sprint-3-implement-and-rewrite

Conversation

@shirinpanahian

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

Task code

CYF-1059

Changelist

I built code while writing tests for the code using node and jest to test.

@shirinpanahian shirinpanahian added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 13, 2026
Comment thread implement-and-rewrite-tests/implement/3-get-card-value.js Outdated
Comment thread implement-and-rewrite-tests/implement/3-get-card-value.js Outdated
expect(() => getAngleType(" ")).toThrow("Input must be a number");
expect(() => getAngleType("Shirin")).toThrow("Input must be a number");
expect(() => getAngleType("*123")).toThrow("Input must be a number");
});

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.

According to the spec defined in 1-get-angle-type.js, the function only needs to handle arguments of type number, and any number that cannot be classified as one of the above named angles are invalid angles.

Could you update this test and the function implementation accordingly?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've updated the function to handle numeric inputs and throw an "Invalid angle" error for numbers that don't match any of the named angle types. I've also updated the tests to cover the valid angle types and invalid numeric values.

Comment on lines +30 to +41
test(`should return true when denominator is negative and bigger`, () => {
expect(isProperFraction(2, -5)).toEqual(true);
});

test(`should return false when denominator is negative ans smaller`, () => {
expect(isProperFraction(4, -3)).toEqual(false);
});

test(`should return correct answer when both is negative`, () => {
expect(isProperFraction(-4, -3)).toEqual(false);
expect(isProperFraction(-1, -3)).toEqual(true);
});

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.

Note: Could consider using pseudo-code or math notations like abs(...) or | ... | in the descriptions to more
concisely describe the conditions (the "when" part).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I've updated the test descriptions to use absolute-value notation, making the conditions more concise and easier to understand.

Comment on lines +12 to +14
test(`Should return number for Valid digit card`, () => {
expect(getCardValue("3♠")).toEqual(3);
});

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.

  • Note: We call this kind of cards , number cards.

  • Could consider testing more samples in each of the test category.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've added more examples to each test category to improve test coverage.

@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 Oct 19, 2026
@shirinpanahian shirinpanahian 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 19, 2026
@cjyuan

cjyuan commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Changes look good. Well done!

@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 Oct 19, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants