Skip to content

Manchester | 26-ITP-May | Szidonia Bodo | Sprint 3 | Implement and review test - #1520

Open
bodoszidi wants to merge 12 commits into
CodeYourFuture:mainfrom
bodoszidi:Sprint-3.1
Open

Manchester | 26-ITP-May | Szidonia Bodo | Sprint 3 | Implement and review test#1520
bodoszidi wants to merge 12 commits into
CodeYourFuture:mainfrom
bodoszidi:Sprint-3.1

Conversation

@bodoszidi

@bodoszidi bodoszidi commented Jul 16, 2026

Copy link
Copy Markdown

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

Created a new pull request only for implementation and review test

@github-actions

This comment has been minimized.

@bodoszidi bodoszidi 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 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@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 Jul 16, 2026
@github-actions

This comment has been minimized.

@bodoszidi bodoszidi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 16, 2026
@Liam310 Liam310 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 Jul 21, 2026
Comment thread Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js Outdated
assertEquals(isProperFraction(-8, 2), false);
assertEquals(isProperFraction(4, 0), false);
assertEquals(isProperFraction(0, 0), false);
assertEquals(isProperFraction(-2, -2), false)

@Liam310 Liam310 Jul 22, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you were to check the case of isProperFraction(-1, 2), what do we want to see as the answer? And would that test pass?

(Things get a little awkwardly mathsy with negative fractions, I recognise)

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.

Since the function requires the numerator to be greater than 0, a negative numerator should return false.
The test isProperFraction(-1, 2) would pass because numerator > 0 will return false.

assertEquals(getCardValue("J♦"), 10);
assertEquals(getCardValue("7♥"), 7);
assertEquals(getCardValue("A♥"), 11);
assertEquals(getCardValue("8♥"), 8);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When writing a test suite, we want to try and cover all possible "behaviours" of our function. Here I can see you've covered:

  • Hearts
  • Spades
  • Diamonds
  • Numbered cards
  • Jacks
  • Aces

Looking at that list, what have you not covered?

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 haven't covered Clubs (♣) or the other face cards (Q and K). Although they are handled by the same logic as Jacks, adding test cases for them would improve coverage and help catch any mistakes in those specific conditions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Still looks like there's one suit we haven't covered yet 👀

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.

Added the missing suit and new test cases.


test(`should return false when denominator is bigger than the numerator`, () => {
expect(isProperFraction(5, -2)).toEqual(false);
expect(isProperFraction(-1, 0)).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.

expect(isProperFraction(-1, 0)).toEqual(false);

This test case, which test does it belong in? What grouping of behaviours does it fall into?

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.

Should be in a different case to test negative numbers - updated the test file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Two things:

  1. I think there is an earlier test description that really best describes the isProperFraction(-1, 0) case!
  2. Numerator/denominator being negative technically doesn't determine whether a fraction is proper or improper. For example, isProperFraction(-2, 5) should actually be true because 2 is smaller than 5. How you could account for this?

@Liam310

Liam310 commented Jul 22, 2026

Copy link
Copy Markdown

Hey @bodoszidi! 👋

Good work on your first journey into using tests. Writing tests from scratch is not easy, it's a skill that takes a while to develop but there's a lot of good stuff in here.

My comments are mostly about focussing on how to organise our test cases. The main things we want to be doing are:

  • Trying to achieve good test coverage, which means "have we considered all possible scenarios here?"
  • Defining tests according to "behaviours" of the function, which means thinking about "how does the function behave with a certain type of input?" and figuring out how to group those inputs when relevant. A good rule of thumb is: if they're all handled by the same bit of logic in the function, they should probably be grouped as part of the same behaviour.

Please do respond to any comments with answers or further questions if you aren't sure what I'm talking about! 😄

@Liam310 Liam310 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 Jul 22, 2026
Removed redundant comments from test cases for clarity.
…ional tests

Refactor variable declaration to use const for removeSuit and add test cases for Queen and King.
@bodoszidi bodoszidi 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 Jul 24, 2026
@Liam310

Liam310 commented Jul 28, 2026

Copy link
Copy Markdown

@bodoszidi Good improvements! Just a couple of lingering comments around handling negative fractions 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants