1010function getAngleType ( angle ) {
1111 if ( angle === 90 ) {
1212 return "Right angle" ;
13+
14+ } else if ( angle < 90 ) {
15+ return "Acute angle" ;
16+ }
17+ else if ( angle > 90 && angle < 180 ) {
18+ return "Obtuse angle" ;
19+ }
20+ else if ( angle === 180 ) {
21+ return "Straight angle" ;
1322 }
23+ else if ( angle > 180 && angle < 360 ) {
24+ return "Reflex angle" ;
25+ }
26+ }
27+
1428 // Run the tests, work out what Case 2 is testing, and implement the required code here.
15- // Then keep going for the other cases, one at a time.
16- }
29+ // Then keep going for the other cases, one at a time. }
1730
1831// The line below allows us to load the getAngleType function into tests in other files.
1932// This will be useful in the "rewrite tests with jest" step.
@@ -50,14 +63,18 @@ assertEquals(acute, "Acute angle");
5063// When the angle is greater than 90 degrees and less than 180 degrees,
5164// Then the function should return "Obtuse angle"
5265const obtuse = getAngleType ( 120 ) ;
53- // ====> write your test here, and then add a line to pass the test in the function above
66+ assertEquals ( obtuse , "Obtuse angle" ) ;
5467
5568// Case 4: Identify Straight Angles:
5669// When the angle is exactly 180 degrees,
5770// Then the function should return "Straight angle"
58- // ====> write your test here, and then add a line to pass the test in the function above
71+ const straightangle = getAngleType ( 180 ) ;
72+ assertEquals ( straightangle , "Straight angle" ) ;
5973
6074// Case 5: Identify Reflex Angles:
6175// When the angle is greater than 180 degrees and less than 360 degrees,
6276// Then the function should return "Reflex angle"
63- // ====> write your test here, and then add a line to pass the test in the function above
77+ const reflex = getAngleType ( 270 ) ;
78+ assertEquals ( reflex , "Reflex angle" ) ;
79+
80+ // Sprint-3-implement 1-get-angle-type.js all assertions and necessary functions added
0 commit comments