Skip to content

Commit 0709cbe

Browse files
Implement straight angle identification in getAngleType function and add corresponding test case
1 parent 32eef26 commit 0709cbe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function getAngleType(angle) {
1111
if (angle === 90) return "Right angle";
1212
if (angle < 90) return "Acute angle";
1313
if (angle > 90) && (angle < 180)) return "Obtuse angle";
14+
if (angle === 180) return "Straight angle";
1415
// Run the tests, work out what Case 2 is testing, and implement the required code here.
1516
// Then keep going for the other cases, one at a time.
1617
}
@@ -56,6 +57,8 @@ const obtuse = getAngleType(120);
5657
// When the angle is exactly 180 degrees,
5758
// Then the function should return "Straight angle"
5859
// ====> write your test here, and then add a line to pass the test in the function above
60+
const straight = getAngleType(180);
61+
assertEquals(straight, "Straight angle");
5962

6063
// Case 5: Identify Reflex Angles:
6164
// When the angle is greater than 180 degrees and less than 360 degrees,

0 commit comments

Comments
 (0)