Skip to content

Commit f4f86c7

Browse files
committed
updates for sprint 3 completed 1&2
1 parent 4a75c58 commit f4f86c7

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,41 @@ const getAngleType = require("../implement/1-get-angle-type");
55
// TODO: Write tests in Jest syntax to cover all cases/outcomes,
66
// including boundary and invalid cases.
77

8+
89
// Case 1: Acute angles
9-
test(`should return "Acute angle" when (0 < angle < 90)`, () => {
10-
// Test various acute angles, including boundary cases
10+
test("should identify acute angles", () => {
1111
expect(getAngleType(1)).toEqual("Acute angle");
1212
expect(getAngleType(45)).toEqual("Acute angle");
1313
expect(getAngleType(89)).toEqual("Acute angle");
1414
});
1515

1616
// Case 2: Right angle
17+
test("should identify right angles", () => {
18+
expect(getAngleType(90)).toEqual("Right angle");
19+
});
20+
1721
// Case 3: Obtuse angles
22+
test("should identify obtuse angles", () => {
23+
expect(getAngleType(91)).toEqual("Obtuse angle");
24+
expect(getAngleType(120)).toEqual("Obtuse angle");
25+
expect(getAngleType(179)).toEqual("Obtuse angle");
26+
});
27+
1828
// Case 4: Straight angle
29+
test("should identify straight angles", () => {
30+
expect(getAngleType(180)).toEqual("Straight angle");
31+
});
32+
1933
// Case 5: Reflex angles
34+
test("should identify reflex angles", () => {
35+
expect(getAngleType(190)).toEqual("Reflex angle");
36+
expect(getAngleType(270)).toEqual("Reflex angle");
37+
expect(getAngleType(359)).toEqual("Reflex angle");
38+
});
39+
2040
// Case 6: Invalid angles
41+
test("should identify invalid angles", () => {
42+
expect(getAngleType(-1)).toEqual("Invalid angle");
43+
expect(getAngleType(361)).toEqual("Invalid angle");
44+
expect(getAngleType(400)).toEqual("Invalid angle");
45+
});

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,27 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
88
test(`should return false when denominator is zero`, () => {
99
expect(isProperFraction(1, 0)).toEqual(false);
1010
});
11+
// Case 1: Proper fractions
12+
test(`should return true for proper fractions`, () => {
13+
expect(isProperFraction(1, 2)).toEqual(true);
14+
expect(isProperFraction(-1, 2)).toEqual(true);
15+
expect(isProperFraction(1, -2)).toEqual(true);
16+
expect(isProperFraction(-1, -2)).toEqual(true);
17+
expect(isProperFraction(0, 2)).toEqual(true);
18+
});
19+
20+
// Case 2: Improper fractions
21+
test(`should return false for improper fractions`, () => {
22+
expect(isProperFraction(2, 1)).toEqual(false);
23+
expect(isProperFraction(-2, 1)).toEqual(false);
24+
expect(isProperFraction(2, -1)).toEqual(false);
25+
expect(isProperFraction(-2, -1)).toEqual(false);
26+
expect(isProperFraction(2, 2)).toEqual(false);
27+
expect(isProperFraction(-2, -2)).toEqual(false);
28+
});
29+
// Case 3: Invalid fractions (denominator is zero)
30+
test(`should return false when denominator is zero`, () => {
31+
expect(isProperFraction(1, 0)).toEqual(false);
32+
expect(isProperFraction(-1, 0)).toEqual(false);
33+
expect(isProperFraction(0, 0)).toEqual(false);
34+
});

0 commit comments

Comments
 (0)