1010function getAngleType ( angle ) {
1111 if ( angle === 90 ) {
1212 return "Right angle" ;
13+ } else if ( angle < 90 ) {
14+ return "Acute 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 > 180 && angle < 360 ) {
20+ return "Reflex angle" ;
1321 }
22+ }
1423 // Run the tests, work out what Case 2 is testing, and implement the required code here.
1524 // Then keep going for the other cases, one at a time.
16- }
25+
1726
1827// The line below allows us to load the getAngleType function into tests in other files.
1928// This will be useful in the "rewrite tests with jest" step.
@@ -39,25 +48,37 @@ function assertEquals(actualOutput, targetOutput) {
3948// Then the function should return "Right angle"
4049const right = getAngleType ( 90 ) ;
4150assertEquals ( right , "Right angle" ) ;
51+ console . log ( getAngleType ( 90 ) ) ;
4252
4353// Case 2: Identify Acute Angles:
4454// When the angle is less than 90 degrees,
4555// Then the function should return "Acute angle"
4656const acute = getAngleType ( 45 ) ;
4757assertEquals ( acute , "Acute angle" ) ;
58+ console . log ( getAngleType ( 45 ) ) ;
4859
4960// Case 3: Identify Obtuse Angles:
5061// When the angle is greater than 90 degrees and less than 180 degrees,
5162// Then the function should return "Obtuse angle"
5263const obtuse = getAngleType ( 120 ) ;
64+ assertEquals ( obtuse , "Obtuse angle" ) ;
65+ console . log ( getAngleType ( 120 ) ) ;
66+
5367// ====> write your test here, and then add a line to pass the test in the function above
5468
5569// Case 4: Identify Straight Angles:
5670// When the angle is exactly 180 degrees,
5771// Then the function should return "Straight angle"
72+ const straight = getAngleType ( 180 ) ;
73+ assertEquals ( straight , "Straight angle" ) ;
74+ console . log ( getAngleType ( 180 ) ) ;
75+
5876// ====> write your test here, and then add a line to pass the test in the function above
5977
6078// Case 5: Identify Reflex Angles:
6179// When the angle is greater than 180 degrees and less than 360 degrees,
6280// Then the function should return "Reflex angle"
81+ const Reflex = getAngleType ( 200 ) ;
82+ assertEquals ( Reflex , "Reflex angle" ) ;
83+ console . log ( getAngleType ( 200 ) ) ;
6384// ====> write your test here, and then add a line to pass the test in the function above
0 commit comments