Skip to content

London | 26-ITP-Sep | Rhoda Ajiroba | Sprint 3 | Implement and Rewrite Tests - #1770

Open
codebyra wants to merge 2 commits into
CodeYourFuture:mainfrom
codebyra:coursework/implement-and-rewrite-tests-clean
Open

codebyra wants to merge 2 commits into
CodeYourFuture:mainfrom
codebyra:coursework/implement-and-rewrite-tests-clean

Conversation

@codebyra

@codebyra codebyra commented Nov 9, 2026

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

Implemented getAngleType, isProperFraction, and getCardValue. Added comprehensive tests using Node's built-in test runner and rewrote the tests using Jest, covering normal cases, boundary cases, and invalid inputs. All tests pass.

@codebyra codebyra added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 9, 2026
@hackertainment hackertainment 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 Nov 10, 2026
@github-actions

Copy link
Copy Markdown

The files changed in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the 'files changed' tab at the top of the page.

Here is an example of a file that has been changed on this branch but shouldn't be: practice-tdd/count.js

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions

Copy link
Copy Markdown

The files changed in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the 'files changed' tab at the top of the page.

Here is an example of a file that has been changed on this branch but shouldn't be: practice-tdd/count.js

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@hackertainment hackertainment left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code looks quite clean to me, and please keep it up. Just need a few test cases for negative proper fraction and an explanation to one of my comments. Also, please remove files that do not belong to this exercise (ref: #1770 (comment) ). Thank you.

Comment on lines +20 to +28
test("Handles negative numerators", () => {
assert.equal(isProperFraction(-1, 2), true);
assert.equal(isProperFraction(-5, 2), false);
});

test("Handles negative denominators", () => {
assert.equal(isProperFraction(1, -2), true);
assert.equal(isProperFraction(3, -2), false);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How about both numerator and denominator are negative (e.g. -1/-2 and -2/-1)?

Comment on lines +17 to +25
test("Handles negative numerators", () => {
expect(isProperFraction(-1, 2)).toEqual(true);
expect(isProperFraction(-5, 2)).toEqual(false);
});

test("Handles negative denominators", () => {
expect(isProperFraction(1, -2)).toEqual(true);
expect(isProperFraction(3, -2)).toEqual(false);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How about both numerator and denominator are negative (e.g. -1/-2 and -2/-1)?


export function getCardValue(card) {
// TODO: Implement this function
const validCard = /^(A|[2-9]|10|J|Q|K)[♠♥♦♣]$/;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line and your program is correct. For me to understand your thinking process, can you please explain the breakdown of the expression you used (and any possible chance to simplify it)? Also, what are the advantages of using such expression over other implementations? No code change is required and just adding a reply to this comment would be good enough. Thank you.

@hackertainment hackertainment 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 Nov 10, 2026
@github-actions

Copy link
Copy Markdown

The files changed in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the 'files changed' tab at the top of the page.

Here is an example of a file that has been changed on this branch but shouldn't be: practice-tdd/count.js

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions

Copy link
Copy Markdown

The files changed in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the 'files changed' tab at the top of the page.

Here is an example of a file that has been changed on this branch but shouldn't be: practice-tdd/count.js

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

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