Skip to content

London | 26-ITP-Sep | Bartosz Kawiak | Sprint 3 | implement-and-rewrite-tests - #1624

Open
bartoszkawiak wants to merge 1 commit into
CodeYourFuture:mainfrom
bartoszkawiak:coursework/sprint-3-implement-and-rewrite
Open

bartoszkawiak wants to merge 1 commit into
CodeYourFuture:mainfrom
bartoszkawiak:coursework/sprint-3-implement-and-rewrite

Conversation

@bartoszkawiak

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

Completed the implementation exercises first, then added tests using Jest to cover different inputs, outcomes, and edge cases. Fixed issues found during testing and confirmed the tests pass.

@bartoszkawiak bartoszkawiak added Module-Structuring-And-Testing-Data The name of the module. 📅 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. labels Sep 24, 2026

@LonMcGregor LonMcGregor 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.

Good start on this task, The angles task is complete. I have some comments on the others.

//Unit fractions all have a numerator of 1.

let validFraction = numerator < denominator && numerator > 0;
if (validFraction) {

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 if statement looks a bit complicated. Do you think it could be simplified?

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.

After looking into it I realised the if statement wasn't needed because the conditions I assigned to validFraction already return either true or false so I can just return the variable directly.

expect(isProperFraction(-5, 5)).toEqual(false);
});
test(`should return false when ( numerator < negative denominator )`, () => {
expect(isProperFraction(3, -5)).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.

In this kind of maths, whenever the numerators value is lower than the denominator, regardless of ± sign, it is considered a true proper fraction. So -4/8 and 3/-5 are both valid proper fractions. Could you take another try at this?

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 clarification. I've updated the function to compare the absolute values of the numerator and denominator and added tests to cover the different positive and negative combinations.

for (let number = 2; number <= 10; number++) {
for (let suit of suits) {
test(`should return card value as number`, () => {
expect(getCardValue(`${number}${suit}`)).toEqual(number);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I appreciate the effort gone to test these thoroughly, but one thing to be careful of is if you make your tests so complicated that the tests themselves need testing. As a general rule, it's better to pick out specific cases that test the general input and the edge cases rather than needing to create loops and data structures to test every single possible input.

Do you have nay thoughts on the approach you used here?

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.

That makes sense. I wanted to check every possible number and suit to make sure they all worked correctly. I figured that using a loop would be the most efficient approach, but I can see how testing a few specific cases would make testing simpler. Thank you for the feedback.

@LonMcGregor LonMcGregor 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 Sep 28, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@bartoszkawiak bartoszkawiak added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026
@bartoszkawiak bartoszkawiak added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026
@bartoszkawiak bartoszkawiak added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026
@bartoszkawiak
bartoszkawiak force-pushed the coursework/sprint-3-implement-and-rewrite branch from 9d8a18b to aea8177 Compare October 5, 2026 13:38
@bartoszkawiak bartoszkawiak added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 5, 2026

@LonMcGregor LonMcGregor 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.

Great,this task is complete now. Good work

@LonMcGregor LonMcGregor 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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 6, 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