Skip to content

Glasgow | 26-ITP-May | Niangh Ciang | Sprint 3 | Implement and rewrite tests#1401

Open
Niangh-Ciang wants to merge 7 commits into
CodeYourFuture:mainfrom
Niangh-Ciang:coursework/sprint-3-implement-and-rewrite
Open

Glasgow | 26-ITP-May | Niangh Ciang | Sprint 3 | Implement and rewrite tests#1401
Niangh-Ciang wants to merge 7 commits into
CodeYourFuture:mainfrom
Niangh-Ciang:coursework/sprint-3-implement-and-rewrite

Conversation

@Niangh-Ciang

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

Implemented all three functions and rewrote their test suites using Jest.
Covered all required cases including valid, boundary, and invalid inputs.

@Niangh-Ciang Niangh-Ciang 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 Jun 26, 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.

Very good work on these. It's just your fractions implementation that needs another update


function isProperFraction(numerator, denominator) {
// TODO: Implement this function
if (numerator > 0 && denominator > 0 && numerator < denominator) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could this function be simplified? (Hint: your are returning true/false from an if condition)

assertEquals(isProperFraction(1, 2), true);
assertEquals(isProperFraction(5, 10), true);
assertEquals(isProperFraction(2, 3), true);
assertEquals(isProperFraction(-2, 4), 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.

-2/4 is actually a proper fraction. Can you check your test and implementation to see how to resolve this?

expect(isProperFraction(1, 2)).toEqual(true);
expect(isProperFraction(3, 5)).toEqual(true);
});
test("should return false when numerator is negative", () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See also my remark above. Fractions can have a negative numerator and still be valid proper fractions.

@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 Jul 1, 2026
@Niangh-Ciang

Copy link
Copy Markdown
Author

Hello, I have fixed the proper fraction logic.

@Niangh-Ciang Niangh-Ciang 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 1, 2026
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