Skip to content

Commit 532fd66

Browse files
committed
Implement getAngleType with complete test coverage and improved test feedback
1 parent 65fe894 commit 532fd66

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Sprint-3/1-key-implement/1-get-angle-type.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88
// Then, write the next test! :) Go through this process until all the cases are implemented
99

1010
function getAngleType(angle) {
11-
if (angle === 90) return "Right angle";
12-
// read to the end, complete line 36, then pass your test here
11+
if (angle === 90) return "Right angle";
12+
if (angle < 90) return "Acute angle";
13+
if (angle > 90 && angle < 180) return "Obtuse angle";
14+
if (angle === 180) return "Straight angle";
15+
if (angle > 180 && angle < 360) return "Reflex angle";
16+
17+
// read to the end, complete line 36, then pass your test here
1318
}
1419

1520
// we're going to use this helper function to make our assertions easier to read
@@ -43,14 +48,19 @@ assertEquals(acute, "Acute angle");
4348
// When the angle is greater than 90 degrees and less than 180 degrees,
4449
// Then the function should return "Obtuse angle"
4550
const obtuse = getAngleType(120);
51+
assertEquals(obtuse, "Obtuse angle");
4652
// ====> write your test here, and then add a line to pass the test in the function above
4753

4854
// Case 4: Identify Straight Angles:
4955
// When the angle is exactly 180 degrees,
5056
// Then the function should return "Straight angle"
5157
// ====> write your test here, and then add a line to pass the test in the function above
58+
const straight = getAngleType(180);
59+
assertEquals(straight, "Straight angle");
5260

5361
// Case 5: Identify Reflex Angles:
5462
// When the angle is greater than 180 degrees and less than 360 degrees,
5563
// Then the function should return "Reflex angle"
56-
// ====> write your test here, and then add a line to pass the test in the function above
64+
// ====> write your test here, and then add a line to pass the test in the function above
65+
const reflex = getAngleType(270);
66+
assertEquals(reflex, "Reflex angle");

0 commit comments

Comments
 (0)