88// Then, write the next test! :) Go through this process until all the cases are implemented
99
1010function getAngleType ( angle ) {
11- if ( angle === 90 ) {
11+ if ( angle < 90 ) {
12+ return "Acute angle" ;
13+ } else if ( angle === 90 ) {
1214 return "Right angle" ;
15+ } else if ( angle > 90 && angle < 180 ) {
16+ return "Obtuse angle" ;
17+ } else if ( angle === 180 ) {
18+ return "Straight angle" ;
19+ } else if ( angle < 360 ) {
20+ return "Reflex angle" ;
1321 }
14- // 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.
22+ // Run the tests, work out what Case 2 is testing, and implement the required code here.
23+ // Then keep going for the other cases, one at a time.
1624}
1725
1826// The line below allows us to load the getAngleType function into tests in other files.
@@ -50,14 +58,17 @@ assertEquals(acute, "Acute angle");
5058// When the angle is greater than 90 degrees and less than 180 degrees,
5159// Then the function should return "Obtuse angle"
5260const obtuse = getAngleType ( 120 ) ;
53- // ====> write your test here, and then add a line to pass the test in the function above
61+ assertEquals ( obtuse , "Obtuse angle" ) ;
5462
5563// Case 4: Identify Straight Angles:
5664// When the angle is exactly 180 degrees,
5765// 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
66+ const straight = getAngleType ( 180 ) ;
67+ assertEquals ( straight , "Straight angle" ) ;
5968
6069// Case 5: Identify Reflex Angles:
6170// When the angle is greater than 180 degrees and less than 360 degrees,
6271// 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
72+ // ====> write your test here, and then add a line to pass the test in the function above
73+ const reflex = getAngleType ( 200 ) ;
74+ assertEquals ( reflex , "Reflex angle" ) ;
0 commit comments