Repository navigation
London | 26-ITP-Sep | Mars Adesina | Sprint 2 | Implement and rewrite tests #1718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3c34300
a3e94a4
e24692a
9aafc79
db06ff6
2e539b5
874aa37
190c45b
5bf0d70
9faf227
b7ac8b6
f5f0c00
780ce9a
d242353
ff0d518
f049f47
036f167
8631a7e
7797f0c
5651ef6
d47c1c7
57a3aba
7d65d6f
f989cbd
8d09a15
728add3
122cf3c
d7789c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,30 @@ import { isProperFraction } from "../implement/2-is-proper-fraction.js"; | |
| test(`should return false when denominator is zero`, () => { | ||
| expect(isProperFraction(1, 0)).toEqual(false); | ||
| }); | ||
|
|
||
| test(`should return false when numerator is larger than denominator`, () => { | ||
| expect(isProperFraction(6, 4)).toEqual(false); | ||
| }); | ||
|
|
||
| test(`should return false when numerator and denominator are the same value`, () => { | ||
| expect(isProperFraction(3, 3)).toEqual(false); | ||
| }); | ||
| test(`should return true when is a proper fraction`, () => { | ||
| expect(isProperFraction(1, 2)).toEqual(true); | ||
| }); | ||
|
|
||
| test(`should return true when numerator is 0`, () => { | ||
| expect(isProperFraction(0, 1)).toEqual(true); | ||
| }); | ||
|
|
||
| test(`proper fraction with a negative numerator but positive denominator`, () => { | ||
| expect(isProperFraction(-2, 3)).toEqual(true); | ||
| }); | ||
|
|
||
| test(`proper fraction with a positive numerator but negative denominator`, () => { | ||
| expect(isProperFraction(2, -3)).toEqual(true); | ||
| }); | ||
|
|
||
| test(`proper fraction with both a negative numerator and denominator`, () => { | ||
| expect(isProperFraction(-2, -3)).toEqual(true); | ||
| }); | ||
|
Comment on lines
+25
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Rather than writing a separate test for each sign combination, you could consider grouping inputs that exercise the same behaviour into one test, under a test description that is applicable to all. For example, test("should return true when abs(numerator) < abs(denominator)", () => {
expect(isProperFraction(1, 2)).toEqual(true);
expect(isProperFraction(-1, 2)).toEqual(true);
expect(isProperFraction(1, -2)).toEqual(true);
expect(isProperFraction(-1, -2)).toEqual(true);
});Note: Use of widely recognised pseudo-code and math notations like No change required |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why import
get? Where is it used?